The same thing is happeneing as before,
the LCD is just showing 'Waiting ... ' on the receiving unit
And I can see on the scope a signal coming in on portB3
ken
The same thing is happeneing as before,
the LCD is just showing 'Waiting ... ' on the receiving unit
And I can see on the scope a signal coming in on portB3
ken
Last edited by lerameur; - 23rd December 2006 at 22:46.
the first line of the receiving unit is blank
the second: waiting ....
k
Ok, obviously the temp sensor code is working fine, and the receiver code is 'working'.
Check your wiring again. This should be working just fine. I just built up the same thing (during the last 10 minutes), 2 PIC16F628A's, exact code, simulated the one-wire temp sensor in the transmit section with some dummy values, added a button to change the number when pressed.
Both transmit and receive sections worked fine.
Are both sections on the same power and ground lines?
Use this code. Again, make the LCD work for you....
'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
try1 var byte : output portb.2 : input portb.3 : dq var portb.4 : temp var word : tempf var word
pause 2500
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 , "Displaying" , DEC3 try1 , "," , DEC3 try2
lcdout $fe , $80 , "Tc=" , DEC temp , "C,Tf=" , DEC tempf , "F.."
lcdout $fe , $c0 , "Sending..." , DEC3 try1 , "," , DEC3 try2
serout portb.2 , n2400 , [ temp.highbyte , temp.lowbyte ]
serout portb.2 , n2400 , [ tempf.highbyte , tempf.lowbyte ]
lcdout $fe , $c0 , "Data Sent." , DEC3 try1 , "," , DEC3 try2
goto loop
End
'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
'try1 = count of times waiting for bytes, try2 = count of bytes received
try1 var byte : try2 var byte : temp var word : tempf var word : input portb.3 : pause 2500
loop:
lcdout $fe , $c0 , "Waiting..." , DEC3 try1 , "," , DEC3 try2
try1 = try1 + 1
serin portB.3 , n2400 , 1000 , loop , [ temp.highbyte , temp.lowbyte , tempf.highbyte , tempf.lowbyte ]
try2 = try2 + 2
lcdout $fe , $c0 , "Received.." , DEC3 try1 , "," , DEC3 try2
lcdout $fe , $c0 , "Displaying" , DEC3 try1 , "," , DEC3 try2
lcdout $fe , $80 , "Tc=" , DEC temp , "C,Tf=" , DEC tempf , ".."
lcdout $fe , $c0 , "Displayed." , DEC3 try1 , "," , DEC3 try2
goto loop
End
Last edited by skimask; - 23rd December 2006 at 23:24. Reason: Added code
yes they are on the same vdd and ground,
I just tried seperating them by putting the sedning end on a battery but no diferent.
Also the receiving, here is only one wire that is going in , the other wires are used for the LCD, obviously, the lcd works. I am putting the scope on the incoming port adn there is a signal in . The signal is sent every 500ms, Maybe that is too slow ?? and the receiving cant see it ..
ken
Bookmarks