Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Scrolling LEDs with Sure Electronics ATmega 16 Demo Board

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
W4GNS

Bascom Member



Joined: 03 Dec 2009
Posts: 11
Location: (Virginia)

usa.gif
PostPosted: Sun Aug 07, 2011 11:25 pm    Post subject: Scrolling LEDs with Sure Electronics ATmega 16 Demo Board Reply with quote

Howdy Folks
I just loaded the following code into a Sure Elect Demo Board and they are not behaving as expected. PortA.1 and PortA.2 light at the same time and start dim, then brighten up. I'm certain that I forgetting to set something but not sure what, any comments/suggestions ?

Thanks Gary - W4GNS


Code:

'******************************************************
'*  Blink LED's using Sure Electronics AVR Dem2
'*  ATmega16
'*
'******************************************************





$regfile = "m16def.dat"
$crystal = 12000000
$hwstack = 80
$swstack = 40
$framesize = 60
'$sim

Config Porta = Output

Led Alias Porta.0
Led1 Alias Porta.1                                          'leds pa0,pa1,pa2,pa3
Led2 Alias Porta.2
Led3 Alias Porta.3

 Do

   Toggle Led
     Waitms 500
      Toggle Led1
       Waitms 500
      Toggle Led2
     Waitms 500
    Toggle Led3
   Waitms 500

 Loop
 

_________________
Bascom-AVR 2.0.7.6

Programmer USBASP (China Version)
Back to top
View user's profile
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2483
Location: Queensland

australia.gif
PostPosted: Sun Aug 07, 2011 11:54 pm    Post subject: Reply with quote

If the brightness changes as you turn on more LEDs, it sounds like you draw far too much current from the port pins. Max current from a port pin is 20mA. You do have resistors ( typically about 1K ) in series with the LEDs ?
_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
W4GNS

Bascom Member



Joined: 03 Dec 2009
Posts: 11
Location: (Virginia)

usa.gif
PostPosted: Sun Aug 07, 2011 11:59 pm    Post subject: Reply with quote

Yup, all is as should be as far as resistors go, this is a pre fab demo board that can be seen here http://www.sure-electronics.com/gallery.php?id=244

Actually I think 1 LED should be lit at a time,but it's not working out like that, thus the issue

AdrianJ wrote:
If the brightness changes as you turn on more LEDs, it sounds like you draw far too much current from the port pins. Max current from a port pin is 20mA. You do have resistors ( typically about 1K ) in series with the LEDs ?

_________________
Bascom-AVR 2.0.7.6

Programmer USBASP (China Version)
Back to top
View user's profile
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2483
Location: Queensland

australia.gif
PostPosted: Mon Aug 08, 2011 3:22 am    Post subject: Reply with quote

Program looks right to me.

The LEDs are active when the port pins are low, according to the schematic. So they should be on when you first turn on the power ( a Reset sets all ports to 0, then the config porta = output would set the lines to output, so all the lines should drive low. )

If this is not what happens, maybe the program is not loaded correctly, or the fuses are not set.

Even without the fuses set, it should do something, maybe at the wrong speed, since by default the internal oscillator will be running, at 1 MHz, so the speed will be about 12x lower than you think, since you specify a 12 mHz clock in Bascom.

_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum