I see what's happening here... as the pic is waiting for DECIMAL number, it will stuck untill there's a none-numeric ASCII value... damn... so just send something else after you send your data and you should be in business.
try this...
vb code
Code:
Public Sub updatetextbox()
TextBox1.Text = serialport.ReadLine
serialport.Write("aaaaOK" & TextBox1.Text & "z")
End Sub
The PIC side..
Code:
@ __CONFIG _XT_OSC & _LVP_OFF
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 5
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 7
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
ADCON1=%00000111
DEFINE DEBUG_REG PORTD ' Set Debug pin port
DEFINE DEBUG_BIT 3 ' Set Debug pin bit
DEFINE DEBUG_BAUD 2400 ' Set Debug baud rate
DEFINE DEBUG_MODE 0 ' Set Debug mode: 0 = true, 1 = inverted
DEFINE DEBUGIN_REG PORTA ' Set Debugin pin port
DEFINE DEBUGIN_BIT 1 ' Set Debugin pin bit
DEFINE DEBUGIN_MODE 0 ' Set Debugin mode: 0 = true, 1 = inverted
temp var word 'storage for temperature
pcsig var word
' Main loop
portc=0
trisc=0
HIGH PORTD.3 ' Serial OUT idle state
pause 500
mainloop:
for temp = 0 to 1000 step 100
lcdout $fe,1,"Temp=", dec temp
debug DEC temp,10
DEBUGIN [WAIT ("OK"), DEC pcsig]
lcdout $fe,$c0,"pcsig=", dec pcsig
PAUSE 1000
next
goto mainloop
END
This echo back the data, not much.
Bookmarks