You're not doing anything wrong - GCBASIC is. I can't reproduce the bug myself with the newest version of GCBASIC and a 16F877A or 18F4550, so download http://gcbasic.sourceforge.net/newfiles/update.zip and see if it goes away.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
this is truncated, but the basic program is:
1. DIM sensor AS word
2. sensor = 1345
3. LCDWord (sensor)
and on the LCD I get "0065"
if I modify "2" line to 'sensor = 1345 [WORD]' then the LCD displays 40001
what am I doing wrong?
-Sterling
You're not doing anything wrong - GCBASIC is. I can't reproduce the bug myself with the newest version of GCBASIC and a 16F877A or 18F4550, so download http://gcbasic.sourceforge.net/newfiles/update.zip and see if it goes away.
Problem still there. Here is the entire program:
---------------------
#chip 16F684, 20
'#config _CP_OFF & _WDT_OFF & _PWRTE_ON & _HS_OSC
#mem 128
DIM potSensor as WORD
#define LCD_IO 4
#define LCD_DB4 PORTC.0
#define LCD_DB5 PORTC.1
#define LCD_DB6 PORTC.2
#define LCD_DB7 PORTC.3
#define LCD_RS PORTC.4
#define LCD_RW PORTA.0
#define LCD_Enable PORTC.5
ADoff
Main:
'initLCD
DIR PORTA.1 IN
wait 1 sec
Print "HELLO WORLD??"
Locate 1,0
potSensor = 1345
LCDWord (potSensor)
wait 50 10ms
cls
Goto Main
-------------------
I'll try a different PIC later.
-Sterling
I tried another PIC 16F648A, and gett the same LCDWord output as with the other PIC.
-Sterling
I think I may have fixed the bug. The updated gcbasic.exe file is in http://gcbasic.sourceforge.net/newfiles/gcbasicexe.zip
That fixed it. Many thanks!
-Sterling