that works
Then again it is only one 8 bit sending/receiving, I need four in the serout, but it is a good step.
that works
Then again it is only one 8 bit sending/receiving, I need four in the serout, but it is a good step.
So it does work, completely, as intended? Temperature is sent over and all that?
Why do you need 4 bytes to go over the link? You can keep doing the math at the receiving end and like I said, temp probably wouldn't ever get above 255C?
Oh...I forgot about the wireless link that was supposed to be there in the first place....
Re-post what you have for code....
Last edited by skimask; - 27th December 2006 at 14:34. Reason: Forgot...
the code I have is the code you have on top a couple of posts ago, I am trying to add multiple items to it though
'receiving:
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
temp var word : temp1 var word : tempf var word : counter var byte
input portb.2 : pause 1000
loop:
counter = counter + 1 : lcdout $fe , $c0 , "Waiting......" , DEC3 counter
serin portb.2 , t2400 , temp
serin portb.2 , t2400 , temp1
tempf = temp * 9 : tempf = tempf / 5 : tempf = tempf + 32
lcdout $fe , $80 , "Tc=" , DEC3 temp , "C,Tf=" , DEC3 temp1 , "F."
lcdout $fe , $c0 , "Received....." , DEC3 counter
goto loop
End
'TRANSMIT PIC
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 33333
counter var byte : temp var word : output portb.2 : high portb.2
input portb.3 : dq var portb.4 : pause 1000
loop:
lcdout $fe , $c0 , "Getting......" , DEC3 counter
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 ]
lcdout $fe , $80 , "Tc=" , DEC3 temp
lcdout $fe , $c0 , "Sending......" , DEC3 counter
serout portb.2 , t2400 , [ temp.lowbyte, temp.highbyte ]
counter = counter + 1
goto loop
[QUOTE=lerameur;30072]the code I have is the code you have on top a couple of posts ago, I am trying to add multiple items to it though
I'm modifying it a bit (adding the manchester encoding stuff) so you can hook up the wireless modules and try it with one byte. Should be easier to add more data after the wireless it working with byte, then to make sure multiple bytes work without the wireless....that's my thought anyways...
you can look at the first post I have manchester encoding there and it works
It probably does work, but I threw this together....unless I made some silly mistakes, this should work with (and without) the wireless modules, in fact it should work just fine with the wire still attached. Maybe it wouldn't be a bad idea to test it out that way also...
'RECEIVE PIC
'same includes and defines as the other versions
temp var word : tempf var word : counter var byte
templo var byte : temphi var byte : input portb.2
converts var byte[15] : convtemp var byte
converts[0]=$55 : converts[1]=$56 : converts[2]=$59 : converts[3]=$5a
converts[4]=$65 : converts[5]=$66 : converts[6]=$69 : converts[7]=$6a
converts[8]=$95 : converts[9]=$96 : converts[10]=$99 : converts[11]=$9a
converts[12]=$a5 : converts[13]=$a6 : converts[14]=$a9 : converts[15]=$aa
pause 1000
loop:
counter = counter + 1 : lcdout $fe , $c0 , "Waiting......" , DEC3 counter
waitfor55:
serin portb.2 , t2400 , temp : if temp <> $55 then goto waitfor55
waitforaa:
serin portb.2 , t2400 , temp : if temp <> $aa then goto waitforaa
serin portb.2 , t2400 , templo : serin portb.2 , t2400 , temphi
for convtemp = 0 to 15
if templo = converts[temp] then temp1 = convtemp
if temphi = converts[temp] then temp2 = convtemp
next convtemp
temp = ( temp2 * 16 ) + temp1
tempf = temp * 9 : tempf = tempf / 5 : tempf = tempf + 32
lcdout $fe , $80 , "Tc=" , DEC3 temp , "C,Tf=" , DEC3 tempf , "F."
lcdout $fe , $c0 , "Received....." , DEC3 count
goto loop
'TRANSMIT PIC
'same includes and defines as the other versions
'can probably reduce the char_pacing value quite a bit now that it's working
counter var byte : temp var word : output portb.2 : high portb.2
input portb.3 : dq var portb.4 : templo var byte : temphi var byte
converts var byte[15] : convtemp var byte
converts[0]=$55 : converts[1]=$56 : converts[2]=$59 : converts[3]=$5a
converts[4]=$65 : converts[5]=$66 : converts[6]=$69 : converts[7]=$6a
converts[8]=$95 : converts[9]=$96 : converts[10]=$99 : converts[11]=$9a
converts[12]=$a5 : converts[13]=$a6 : converts[14]=$a9 : converts[15]=$aa
pause 1000
loop:
lcdout $fe , $c0 , "Getting......" , DEC3 count
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 ]
lcdout $fe , $80 , "Tc=" , DEC3 temp
lcdout $fe , $c0 , "Sending......" , DEC3 count
templo = temp.lowbyte & $f : temphi = temp.lowbyte >> 4
templo = converts[templo] : temphi = converts[temphi]
serout portb.2 , t2400 , [ $55 , $55 , $55 , $55 , $aa ]
serout portb.2 , t2400 , [ templo ] : serout portb.2 , t2400 , [ temphi ]
counter = counter + 1
goto loop
what are temp1 and temp2 used for in the receiving code ?
because it is used at the end of the program , but the value is not initialized to anything, , no input,
Last edited by lerameur; - 27th December 2006 at 16:03.
Bookmarks