Well, I've had a PIC programming board for a year now and finally putting it into action thanks to everyone envolved in GCBasic.
I'm interested in using the Poke command to load a value into Port B. I've read somewhere here that PORTB is a predefined variable name. My question is, how come POKE (PORTB, value) doesn't work yet POKE (6, value) does?
Even if I create a new variable PortB = 6, and use that in the command, it will compile, but not work. Below is the simple flasher I am making, and where I have used "Poke" I was hoping to follow it with the Port and the value I am loading. Am I doing something wrong? I am using the most current version of GCBasic.
'A program to flash LEDs on PORTB
'Chip model
#chip 16F84A, 4
'Set the pin directions
dir PORTB OUT 'set all RB ports to output
PORTB = 6
'Main routine
Start:
B0 = 1 'Set variable B0 to start counting
B1 = 0 'Set variable to 0
Poke (6, B0) 'does not like Poke (PORTB, B0)
wait 100 ms
FOR B2 = 0 to 6
B1 = B0 * 2 'calculate next binar number
B0 = B1
Poke (6, B0) 'again, does not like PORTB in place of 6
wait 50 ms
NEXT
'Jump back to the start of the program
goto Start
I'm only just learning assembly and have so many things planned, I'd really like to sort out my understading of the wording.
Doug
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, I've had a PIC programming board for a year now and finally putting it into action thanks to everyone envolved in GCBasic.
I'm interested in using the Poke command to load a value into Port B. I've read somewhere here that PORTB is a predefined variable name. My question is, how come POKE (PORTB, value) doesn't work yet POKE (6, value) does?
Even if I create a new variable PortB = 6, and use that in the command, it will compile, but not work. Below is the simple flasher I am making, and where I have used "Poke" I was hoping to follow it with the Port and the value I am loading. Am I doing something wrong? I am using the most current version of GCBasic.
'A program to flash LEDs on PORTB
'Chip model
#chip 16F84A, 4
'Set the pin directions
dir PORTB OUT 'set all RB ports to output
PORTB = 6
'Main routine
Start:
B0 = 1 'Set variable B0 to start counting
B1 = 0 'Set variable to 0
Poke (6, B0) 'does not like Poke (PORTB, B0)
wait 100 ms
FOR B2 = 0 to 6
B1 = B0 * 2 'calculate next binar number
B0 = B1
Poke (6, B0) 'again, does not like PORTB in place of 6
wait 50 ms
NEXT
'Jump back to the start of the program
goto Start
I'm only just learning assembly and have so many things planned, I'd really like to sort out my understading of the wording.
Doug
Not sure about poke sintax, but you can just do this:
PORTB = B0
Thanks, that's even better and more straight forward