Programming Help (PICAXE 28)

Below is the code I am trying. I stole it from a book. I figured it was an easy one to start with, but I have a few questions. Can someone explain what TRISB and PORTB are? Also what exactly does POKE do? It looks like it is creating variables LED (at port 0), TRISB and PORTB. When I run the simulator on the code it gives a syntax error on Symbol PORTB = $06 and says Poking at this address is not recommended (POKE TRISB, 0). Can anyone help me understand what this is doing prior to the AGAIN: tag (I put the lines in bold)? Thanks gain! And I promise to make some tutorials once I get some basic stuff working. (I am using a PICAXE 28, but the code was written for PIC 18 if that helps)

Symbol LED = 0
Symbol TRISB = $86
Symbol PORTB = $06

POKE TRISB, 0

AGAIN:
HIGH LED
pause 1000

LOW LED
pause 1000

GOTO AGAIN

END

** Hi If you just want to**

 

Hi

If you just want to toggle a LED on port b I don’t think you need the trisb stuff, I think port b is outputs as standard on the picaxe. That is assuming port b is pins 21 to 28.

 

Try this:

;Will toogle pin21

Symbol LED = 0

AGAIN:
HIGH LED
pause 1000

LOW LED
pause 1000

GOTO AGAIN

END

 

Hope that helps.

Brian

Thanks! That works with the

Thanks! That works with the simulation, but the programming editor wont connect to my project board for some reason. I’ll look more into it tomorrow its late.

 

Don’t sweat the petty things. Don’t pet the sweaty things.

I figured out my problem. I

I figured out my problem. I didn’t set the com port correctly. When I get time this weekend I will make walkthroughs for Breadboard basics and how to do your first project with a PICAXE chip (blinking LED). By the end of the weekend I hope to have a servo turning and maybe work with the SRF05. This is fun :wink:

Don’t sweat the petty things. Don’t pet the sweaty things.