Serin serout problem


Closed Thread
Results 1 to 40 of 337

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    what are temp1 and temp2 used for in the receiving code ?
    Whoops....should be hi and lo instead of 1 and 2

    temp = ( temphi * 16 ) + templo

  2. #2
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    This is one way of encoding I have not seen before,
    you did not like the loop I was doing in the first post ?
    It displays 578C and 872F on the receiver side,
    I will look at the decodin technique, because I do not know if it is encoding error or calculation error.

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    This is one way of encoding I have not seen before,
    you did not like the loop I was doing in the first post ?
    It displays 578C and 872F on the receiver side,
    I will look at the decodin technique, because I do not know if it is encoding error or calculation error.
    Is this with the wireless or with the wires like before? Could be either type of error.... I'll look at it a bit more....

  4. #4
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    still using the wire.

    WHY do you do this :

    templo = temp.lowbyte & $f
    Last edited by lerameur; - 27th December 2006 at 16:33.

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    still using the wire.

    WHY do you do this :

    templo = temp.lowbyte & $f
    That masks off the upper 4 bits ( logical AND, temp.lowbyte AND %00001111 ) and use only the lower 4 bits to convert the nibble value to a byte-wide manchester encoded value....(and with the temphi variable, I shift the upper 4 into the lower 4 and do the same thing with it to get manchester encoded values)...
    And do the same thing in reverse at the other end. Your method that you had when you started might work just fine.

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Ya, I screwed it up again. This gets a bit difficult when you don't run the program immediately to see your errors (which is what you're doing at that end!).

    Another version of the program coming in a couple of minutes (or less)...

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default And yet again...

    '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 templo = convtemp
    if temphi = converts[temp] then temphi = convtemp
    next convtemp

    temp = ( temphi << 4 ) + templo : 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, EXCEPT --------------
    ----------------------------------------------------------------------------------------
    'change the char_pacing value to 500. If it's a large value (above 1000 or so), the receiver loses it's "training"
    ----------------------------------------------------------------------------------------

    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] : 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 , templo , temphi ]
    counter = counter + 1
    goto loop

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  3. serout and serin problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th April 2006, 19:44
  4. Replies: 11
    Last Post: - 13th July 2005, 19:26
  5. SerIn and SerOut
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 21st July 2004, 15:54

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts