Hello
I have not been able to test it, the funny thing is that the print in the help only supports variables:
string, Print, byte, word, integer, and does not support variable bit, have you tried to read the port to a variable?
for example:
AppPortd = PORTD
print "Byte": print AppPortd
let us know if it works
I hope this is help
Marco
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hugh, Evan
I have built this code and test with a simulator, in effect there is an issue
the prints of porta was always 0 even if I raise the bits, and the cuounter increase normally on the display.
Can you watch?
#chip MEGA324P, 16
'LCD connection settings
#define LCD_IO 8
#define LCD_DATA_PORT PORTC
#define LCD_RS PORTD.0
#define LCD_RW PORTD.1
#define LCD_Enable PORTD.2
DIR PORTA IN
do while true
test=test+1
if test=255 then
test=0
End if
cls
AppPortA = PORTA
print "Byte": print AppPortA: Print test
wait 10 ms
loop
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Oops sorry, but I was made an error in the simulator, setting bit in the PORTA in the simulator the value was correctly print on the display
Have you always trouble Joe???
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
the counter is for test that the routine of the display is right when I watch the display refresh the counter , I set the bit on the PORTA register and the valure change on the display. I have test only then a simulator if you always have problem I can test in real hardware for you but only the next week
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was read the datasheet and appeare that for read the pin data you have to read the PINA register, I was tested and setting the bit on the io port work fine but this is not compliant with GCB, read and write PORTX today I will watch again, can you test and report? thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This question doesn't seem to be answered. I want to do essentially the same thing as Joe, so can anybody clarify what needs to be done to achieve this? I'm using GC v0.95.006
Ive been searching the forum and help for a while, but haven't found the answer as yet.
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@Anobium. Thanks fr the reply. I realise now I should have explained more fully what I wanted, but I think you've answered it anyway. I want to get the whole port value, not necessarily the individual pin values. It looks like you're saying if I assign PinB to a variable without giving it a pin number, then it will read the whole port, is that correct? In my case I only need 7 bits, but that should be no issue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK, Thanks. I found that if I Dim PinB then it compiles OK - Is DIMming PinB likely to cause problems? I haven't got the hardware setup to test as yet.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ATMEGA328P Arduino Uno
This code:
dim aa,bb,cc,dd,ee,ff,gg,hh as bit
aa = portd.0
bb = portd.1
cc = portd.2
dd = portd.3
ee = portd.4
ff = portd.5
gg = portd.6
hh = portd.7
cls
locate 0,0
print "Bits ": print hh: print gg: print ff: print ee: print dd: print cc: print bb: print aa
locate 1,0
print "Byte ": print portd
Produces this output:
Bits 00000111
Byte 0
Shouldn't I be able to read the byte value of a port exactly as the bit values of the pins?
Still haven't seen any comments on this. Should I be able to read the state of a port's bits in a single read operation as above?
Thanks
Hello
I have not been able to test it, the funny thing is that the print in the help only supports variables:
string, Print, byte, word, integer, and does not support variable bit, have you tried to read the port to a variable?
for example:
AppPortd = PORTD
print "Byte": print AppPortd
let us know if it works
I hope this is help
Marco
Thanks for the reply Marcoos
Yes, I tried assigning the port value to a variable and then print the variable...same result.
Hugh, Evan
I have built this code and test with a simulator, in effect there is an issue
the prints of porta was always 0 even if I raise the bits, and the cuounter increase normally on the display.
Can you watch?
Oops sorry, but I was made an error in the simulator, setting bit in the PORTA in the simulator the value was correctly print on the display
Have you always trouble Joe???
I'm confused by the code. Where do yuo set the port bits? What's the counter for?
Yes, my code always returns zero.
the counter is for test that the routine of the display is right when I watch the display refresh the counter , I set the bit on the PORTA register and the valure change on the display. I have test only then a simulator if you always have problem I can test in real hardware for you but only the next week
I was read the datasheet and appeare that for read the pin data you have to read the PINA register, I was tested and setting the bit on the io port work fine but this is not compliant with GCB, read and write PORTX today I will watch again, can you test and report? thanks
This question doesn't seem to be answered. I want to do essentially the same thing as Joe, so can anybody clarify what needs to be done to achieve this? I'm using GC v0.95.006
Ive been searching the forum and help for a while, but haven't found the answer as yet.
Thanks
@Sleepwalker. The current method is to read PinX, or, in this example PinB. See sample below.
I did think that we had changed this to be compatible with the normal GCB convention. Something to fix in the future.
~~~~
DIR PortB in
do while true
cls
AppPortb = PinB
test += 1
print "Byte: ": print AppPortb: Print " : ": Print test
wait 10 ms
loop
@Anobium. Thanks fr the reply. I realise now I should have explained more fully what I wanted, but I think you've answered it anyway. I want to get the whole port value, not necessarily the individual pin values. It looks like you're saying if I assign PinB to a variable without giving it a pin number, then it will read the whole port, is that correct? In my case I only need 7 bits, but that should be no issue.
Yes. That should work for you.
When using #Option Explicit I get -
test.gcb (82): Error: Variable PINB was not explicitly declared
I thought this wouldn't need declaring, as it's not a variable. Am I missing something?
Sorry #option explicit is not yet fully supported.
The only workaround is not to use #option explicit.
OK, Thanks. I found that if I Dim PinB then it compiles OK - Is DIMming PinB likely to cause problems? I haven't got the hardware setup to test as yet.