absolutely no changes![]()
O my I changed to this
serin portB.2 , t2400 , [ temp.highbyte , temp.lowbyte , tempf.highbyte , tempf.lowbyte ]
now the temp is showing up on first line, BUT is it showing zeros,
incrementation on try, try2 fixed at 0
check the web page also, for output on lcd
also:
On the receiver side...
Change the word 'Waiting..' to
'Wait 4 it'
and see what happens ----------- Only the display changed
Last edited by lerameur; - 24th December 2006 at 06:42.
receiver side change - That's what I was wondering. I had a case a couple days ago where I thought it was programming, but the PGD wire had come loose from my board, so it wasn't actually programming, even though it didn't report any errors (and I had my verify turned off!).
Changing to t2400 is going to do exactly what you saw. But it doesn't fix anything. Leave it at n2400, or try changing both sides to t2400.
And try putting a small resistor inline with the big yellow wire, about 100 ohms or so. Without it, it's almost like a direct short from power to ground from one PIC to another. I should've caught this earlier.
Last edited by skimask; - 24th December 2006 at 06:47.
I will leave is at n2400 then
also, are you saying my pgd wire is messed up ??
I am not sure what it is ? it is programming the sending side.., I am not sure what you meant
The 100 ohm resistor did not do anything .
Last edited by lerameur; - 24th December 2006 at 06:53.
Yes, try changing both sides to t2400 instead of n2400.
You must be pulling the chips out and programming them. Changing the 'Waiting...' was just a quick way to make sure the PIC was actually being reprogrammed.
I didn't expect the 100 ohm resistor to change anything, it's just a good idea from a 'safety' standpoint, saves PICs from blowing themselves up.
And this is going to sound a bit wierd, but I'm wondering if SERIN and SEROUT don't like to deal with temp.highbyte and would rather deal with a byte value instead. Give me a couple of minutes to rewrite the programs and I'll post them in a couple of minutes.
Last edited by skimask; - 24th December 2006 at 06:58.
I didn't expect the 100 ohm resistor to change anything, it's just a good idea from a 'safety' standpoint, saves PICs from blowing themselves up.[/QUOTE]
ok too much current, I get it
no changes with t2400 on both chips
Ok I changed the speed to 9600.
I get the temperature showing on the receiving ship, but its showing zeros.
also the increment try do not increment , But when i disconnect the wire, it increments every 0.5 sec
Last edited by lerameur; - 24th December 2006 at 07:05.
'RECEIVE
INCLUDE "modedefs.bas"
DEFINE OSC 20 'use external 20mhz crystal
CMCON = 7 : ANSEL = 0 : ADCON1 = 7
DEFINE LCD_DREG PORTA ' Set LCD Data port
DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 1 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 0 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2500
DEFINE LCD_DATAUS 250
'try1 = count of times waiting for data, try2 = count of bytes received
try1 var byte : try2 var byte : temp var word : tempf var word
temp1 var byte : temp2 var byte : temp3 var byte : temp4 var byte
input portb.2 : pause 2500
try1 = 0 : try2 = 0
loop:
lcdout $fe , $c0 , "Waiting.." , DEC3 try1 , "," , DEC3 try2
try1 = try1 + 1 : temp = 0 : tempf = 0
serin portB.2 , t2400 , [ temp1 , temp2 , temp3 , temp4 ]
temp.highbyte = temp1 : temp.lowbyte = temp2 : tempf.highbyte = temp3 : tempf.lowbyte = temp4
if temp + tempf > 0 then try2 = try2 + 1 'if temp+tempf are not 0 then data received
lcdout $fe , $c0 , "Received." , DEC3 try1 , "," , DEC3 try2 : pause 100
lcdout $fe , $c0 , "Display.." , DEC3 try1 , "," , DEC3 try2 : pause 100
lcdout $fe , $80 , "Tc=" , DEC3 temp , "C,Tf=" , DEC3 tempf , ".." : pause 100
lcdout $fe , $c0 , "Shown...." , DEC3 try1 , "," , DEC3 try2 : pause 100
goto loop
End
'TRANSMIT
INCLUDE "modedefs.bas"
DEFINE OSC 20 'use external 20mhz crystal
CMCON = 7 : ANSEL = 0 : ADCON1 = 7
DEFINE LCD_DREG PORTA ' Set LCD Data port
DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 1 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 0 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2500
DEFINE LCD_DATAUS 250
DEFINE CHAR_PACING 16667
try1 var byte : try2 var byte : output portb.2 : input portb.3
dq var portb.4 : temp var word : tempf var word
temp1 var byte : temp2 var byte : temp3 var byte : temp4 var byte
pause 2500
try1 = 0 : try2 = 0
loop:
try1 = try1 + 1
lcdout $fe , $c0 , "Getting.." , DEC3 try1 , "," , DEC3 try2
owout DQ , 1 , [ $cc ] : owout DQ , 0 , [ $44 ] : Pause 500
owout DQ , 1 , [ $cc ] : owout DQ , 0 , [ $be ]
owin DQ , 0 , [ temp.LOWBYTE , temp.HIGHBYTE , skip 6 ]
tempf = temp * 9 : tempf = tempf / 5 : tempf = tempf + 32
lcdout $fe , $c0 , "Display.." , DEC3 try1 , "," , DEC3 try2
lcdout $fe , $80 , "Tc=" , DEC3 temp , "C,Tf=" , DEC tempf , "F."
lcdout $fe , $c0 , "Sending.." , DEC3 try1 , "," , DEC3 try2
temp1 = temp.highbyte : temp2 = temp.lowbyte
serout portb.2 , t2400 , [ temp1 , temp2 ]
temp3 = tempf.highbyte : temp4 = tempf.lowbyte
serout portb.2 , t2400 , [ temp3 , temp4 ]
try2 = try2 + 4 : lcdout $fe , $c0 , "Sent....." , DEC3 try1 , "," , DEC3 try2
goto loop
If that works, then great. I don't know why it works. The PBP manual says the other way should work, but I seem to remember running into this problem before and had to do the same thing, I can't remember what I was doing though.
sorry, still showing zeros at the receiving end, with nothing on the first line
Then try this code for both TX and RX sides:
'RECEIVE
INCLUDE "modedefs.bas"
DEFINE OSC 20 'use external 20mhz crystal
CMCON = 7 : ANSEL = 0 : ADCON1 = 7
DEFINE LCD_DREG PORTA ' Set LCD Data port
DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 1 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 0 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2500
DEFINE LCD_DATAUS 250
'try1 = count of times waiting for data, try2 = count of bytes received
try1 var byte : try2 var byte : temp var word : tempf var word
temp1 var byte : temp2 var byte : temp3 var byte : temp4 var byte
input portb.2 : pause 2500
try1 = 0 : try2 = 0
loop:
lcdout $fe , $c0 , "Waiting.." , DEC3 try1 , "," , DEC3 try2
try1 = try1 + 1 : temp = 0 : tempf = 0
serin portB.2 , t2400 , [ temp1 , temp2 , temp3 , temp4 ]
temp1 = 3 : temp2 = 120 'hardcode receiver to display 888 in tempc space
temp.highbyte = temp1 : temp.lowbyte = temp2 : tempf.highbyte = temp3 : tempf.lowbyte = temp4
if temp + tempf > 0 then try2 = try2 + 1 'if temp+tempf are not 0 then data received
lcdout $fe , $c0 , "Received." , DEC3 try1 , "," , DEC3 try2 : pause 100
lcdout $fe , $c0 , "Display.." , DEC3 try1 , "," , DEC3 try2 : pause 100
lcdout $fe , $80 , "Tc=" , DEC3 temp , "C,Tf=" , DEC3 tempf , ".." : pause 100
lcdout $fe , $c0 , "Shown...." , DEC3 try1 , "," , DEC3 try2 : pause 100
goto loop
End
'TRANSMIT
INCLUDE "modedefs.bas"
DEFINE OSC 20 'use external 20mhz crystal
CMCON = 7 : ANSEL = 0 : ADCON1 = 7
DEFINE LCD_DREG PORTA ' Set LCD Data port
DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 1 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 0 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2500
DEFINE LCD_DATAUS 250
DEFINE CHAR_PACING 16667
try1 var byte : try2 var byte : output portb.2 : input portb.3
dq var portb.4 : temp var word : tempf var word
temp1 var byte : temp2 var byte : temp3 var byte : temp4 var byte
pause 2500
try1 = 0 : try2 = 0
loop:
try1 = try1 + 1
lcdout $fe , $c0 , "Getting.." , DEC3 try1 , "," , DEC3 try2
owout DQ , 1 , [ $cc ] : owout DQ , 0 , [ $44 ] : Pause 500
owout DQ , 1 , [ $cc ] : owout DQ , 0 , [ $be ]
owin DQ , 0 , [ temp.LOWBYTE , temp.HIGHBYTE , skip 6 ]
tempf = temp * 9 : tempf = tempf / 5 : tempf = tempf + 32
tempf = 444 'hardcode transmitter to have 444 in tempf space
lcdout $fe , $c0 , "Display.." , DEC3 try1 , "," , DEC3 try2
lcdout $fe , $80 , "Tc=" , DEC3 temp , "C,Tf=" , DEC tempf , "F."
lcdout $fe , $c0 , "Sending.." , DEC3 try1 , "," , DEC3 try2
temp1 = temp.highbyte : temp2 = temp.lowbyte
serout portb.2 , t2400 , [ temp1 , temp2 ]
temp3 = tempf.highbyte : temp4 = tempf.lowbyte
serout portb.2 , t2400 , [ temp3 , temp4 ]
try2 = try2 + 4 : lcdout $fe , $c0 , "Sent....." , DEC3 try1 , "," , DEC3 try2
goto loop
Bookmarks