PDA

View Full Version : help with code needed



ccronin4
- 24th December 2005, 22:14
I'm trying to learn pic basic programming from the book by dogan ibrahim
"pic basic programming and projects." even though it is compiling the led's should light up seqentiallt but mine as per simulatator hangs on the first 2 outputs?
code from book
symbol trisb =134
symbol portb= 6
symbol led =b0
symbol ms500 = 500
poke trisb,0
led = 0
again:
poke portb,led
pause ms500
led =led+1
goto again
end

my code??

TRISB = 134
PORTB = 6
led VAR PORTA.0
symbol ms500 =500
poke TRISB,0
led =0
again:
poke PORTB,led
pause ms500
led = led+1
goto again
end


can any point out the mistake in syntax or logic???
chris

Mith
- 24th December 2005, 22:48
Try:

led var byte

instead of:

led var porta.0

You are defining 'led' to a port pin and then trying to poke it into another port pin.

That should make it work as expected.