Serin serout problem - Page 2


Closed Thread
Page 2 of 9 FirstFirst 123456 ... LastLast
Results 41 to 80 of 337
  1. #41
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    in the picture I had just finish trying all the B ports., It was in RB6, which was the last of the port I tried
    the sending IS on RB2
    and Receiving is on RB3

    go back to the web site i posted a new picture
    Last edited by lerameur; - 24th December 2006 at 05:00.

  2. #42
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    in the picture I had just finish trying all the B ports., It was in RB6, which was the last of the port I tried
    the sending IS on RB2
    and Receiving is on RB3
    Then put up a fresh picture and change your receiver to portb.2

  3. #43
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Ok so now both receiver and transmitter are on portb.2
    the picture is up

    would the problem be in the software, is the pic16f88 special and need extra attention ?
    Last edited by lerameur; - 24th December 2006 at 05:21.

  4. #44
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    Ok so now both receiver and transmitter are on portb.2
    the picture is up

    would the problem be in the software, is the pic16f88 special and need extra attention ?
    It does...but I think I'm onto something....
    On the receiver PIC, it shows:
    Waiting...127,22
    The 127 is the number of times it's tried to receive data but timed out, the 22 is the number of times it's actually received 4 bytes of data and dropped thru to the display section.
    Post your receiver code as it stands again.
    Something is amiss. If the serial port wasn't receiving anything (i.e. the serin statement always timed out and went back to loop, the 22 should remain a 0).

  5. #45
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    for the receiving code, as soon as I open the power supply I get a different number
    trial1: Waiting... 111,22
    trial2: Waiting... 111,21
    trial3: Waiting... 127,22
    trial4: Waiting... 107,21
    .....
    when I leave the power off for a while, it seems to come back to Waiting... 111,22 when the power is turned on

    once the number is there , it stays, it do not move, NO increment.



    '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.2 , 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



    '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
    try2 var byte
    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
    Last edited by lerameur; - 24th December 2006 at 05:33.

  6. #46
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    '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 data, try2 = count of bytes received
    try1 var byte : try2 var byte : temp var word : tempf var word : input portb.2 : pause 2500
    try1 = 0 : try2 = 0

    loop:
    lcdout $fe , $c0 , "Waiting.." , DEC3 try1 , "," , DEC3 try2
    try1 = try1 + 1
    serin portB.2 , n2400 , 1000 , loop , [ temp.highbyte , temp.lowbyte , tempf.highbyte , tempf.lowbyte ]
    try2 = try2 + 4
    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
    try1 var byte : try2 var byte : output portb.2 : input portb.3
    dq var portb.4 : temp var word : tempf var word
    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
    serout portb.2 , n2400 , [ temp.highbyte , temp.lowbyte ]
    serout portb.2 , n2400 , [ tempf.highbyte , tempf.lowbyte ]
    try2 = try2 + 4 : lcdout $fe , $c0 , "Sent....." , DEC3 try1 , "," , DEC3 try2
    goto loop



    Try those code chunks. I get the feeling that the lcd at the receiver end might have been overwriting itself, thereby blanking out the data or something. I also added a couple of pauses in there so you could see what was going on. Also, you didn't set the receiver port to an input (I know serin says it does this for you, but I never trust stuff like that).

  7. #47
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I tried setting Trisb.2 before and it did ot hnage anythimg so I put it rightback.
    Ok now , the sending side, there is an incrementation, and for the first time try2 is incrementing, and it does so by 4.

    On the receiver side, first line; empty, second line: 'Waiting... 000,000'

    I also added these twoline:
    DEFINE LCD_COMMANDUS 2500
    DEFINE LCD_DATAUS 250
    but no luck either
    Last edited by lerameur; - 24th December 2006 at 06:00.

  8. #48
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I'm off to bed , be back tomorrow morning

  9. #49
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    On the receiver side, first line; empty, second line: 'Waiting... 000,000'
    It's not incrementing at all on the receiving side? Try1 should be going up about once a second.


    Add:
    DEFINE CHAR_PACING 16667

    to the transmit program's defines at the beginning. Maybe the receiver is missing characters 'cause they're coming too fast with the software based serin command. If that fixes it, it'll probably work with a value much less than 16667, but it's a start.
    Last edited by skimask; - 24th December 2006 at 06:11. Reason: added info

  10. #50
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    NO incrementation on the receiver. The same with all zeros all the time
    what about using the serin2 command ??

    with the new define, I can see glitches of 'Sending...' on the second line of the sending side. But most often it is on like before, 'Getting...'
    Last edited by lerameur; - 24th December 2006 at 06:18.

  11. #51
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    NO incrementation on the receiver. The same with all zeros all the time
    what about using the serin2 command ??

    with the new define, I can see glitches of 'Sending...' on the second line of the sending side. But most often it is on like before, 'Getting...'
    Transmit side - sounds like it's doing like it should.

    Receive side - try this one:

    '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 data, try2 = count of bytes received
    try1 var byte : try2 var byte : temp var word : tempf var word : 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 , n2400 , [ temp.highbyte , temp.lowbyte , tempf.highbyte , tempf.lowbyte ]
    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

  12. #52
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    absolutely no changes

  13. #53
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    absolutely no changes
    On the receiver side...
    Change the word 'Waiting..' to
    'Wait 4 it'
    and see what happens

  14. #54
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    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.

  15. #55
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    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
    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.

  16. #56
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    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.

  17. #57
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    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 .
    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.

  18. #58
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    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.

  19. #59
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    '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.

  20. #60
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    sorry, still showing zeros at the receiving end, with nothing on the first line

  21. #61
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    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

  22. #62
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    still no changes from previous. I just check the hardware, and seems to be ok, Cystal is oscillating at 20Mhz on both sides.

  23. #63
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    still no changes from previous. I just check the hardware, and seems to be ok, Cystal is oscillating at 20Mhz on both sides.
    Could ya post another picture?

  24. #64
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    actually I did, th e pic is back , i will do another one with the last circuit
    I just tried sending a constant over, and displaying it on the receiving end and it still gives me zero, maybe breaking the program into even more basic ?

    new PIC online

    with this last program, both counters are working on both chips.
    Last edited by lerameur; - 24th December 2006 at 07:43.

  25. #65
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    actually I did, th e pic is back , i will do another one with the last circuit
    I just tried sending a constant over, and displaying it on the receiving end and it still gives me zero, maybe breaking the program into even more basic ?
    Did you make the changes in post #61?

    I saw the new picture. Let me think about this for a couple of minutes...


    Is the sending pic on the left or the right? Could you mark them with something...piece of masking tape on the transmitting pic or something?
    Last edited by skimask; - 24th December 2006 at 07:45.

  26. #66
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Did you make the changes in post #61?

    I saw the new picture. Let me think about this for a couple of minutes...
    it updated now

  27. #67
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    ok I am gpoing to bed now, see ya tomorrow

  28. #68
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    it updated now
    3 more things to try to get this narrowed down...bear with me....

    Try this out now:


    'RECEIVE 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

    '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 , "FR" : pause 100
    lcdout $fe , $c0 , "Shown...." , DEC3 try1 , "," , DEC3 try2 : pause 100
    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 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
    temp = 888 'hardcode transmitter to have 888 in temp space
    lcdout $fe , $c0 , "Display.." , DEC3 try1 , "," , DEC3 try2
    lcdout $fe , $80 , "Tc=" , DEC3 temp , "C,Tf=" , DEC3 tempf , "FT"
    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

  29. #69
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    o, I wil wait a bit,

    the receing LCD shows only on the second line, with zerosss.

  30. #70
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    o, I wil wait a bit,

    the receing LCD shows only on the second line, with zerosss.
    Are you splitting that program up between the 2 PICs or programming the whole thing into one PIC?

  31. #71
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    like on the picture, its 2 pics

    i tried this thing but it do not work
    loop:
    lcdout $fe , $c0 , "Waiting.." , DEC3 try1 , "," , DEC3 try2
    try1 = try1 + 1 : temp = 0 : tempf = 0
    serin portB.2 , t2400 , [ temp1 , temp2 , temp3 , temp4 ]
    if temp1 > temp2 then
    Portb.4 =1 ------------putting a led here, maybe lcdout is confusing with serin
    pause 500
    portb.4=0
    else
    Portb.3 =1 -----------putting a led here
    pause 500
    portb.3=0
    endif

    goto loop
    End

  32. #72
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Ok I am really going now to sleep, see ya later

  33. #73
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    like on the picture, its 2 pics

    i tried this thing but it do not work
    loop:
    lcdout $fe , $c0 , "Waiting.." , DEC3 try1 , "," , DEC3 try2
    try1 = try1 + 1 : temp = 0 : tempf = 0
    serin portB.2 , t2400 , [ temp1 , temp2 , temp3 , temp4 ]
    if temp1 > temp2 then
    Portb.4 =1 ------------putting a led here, maybe lcdout is confusing with serin
    pause 500
    portb.4=0
    else
    Portb.3 =1 -----------putting a led here
    pause 500
    portb.3=0
    endif

    goto loop
    End


    I meant are you putting the transmit code into the transmit PIC and the receive code into the receive PIC, not the whole thing into both PICs...

  34. #74
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I meant are you putting the transmit code into the transmit PIC and the receive code into the receive PIC, not the whole thing into both PICs...


    'TRANSMIT PIC = one pic

    'RECEIVE PIC = another pic
    dont worry, only the part that belongs there

  35. #75
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    I meant are you putting the transmit code into the transmit PIC and the receive code into the receive PIC, not the whole thing into both PICs...


    'TRANSMIT PIC = one pic

    'RECEIVE PIC = another pic
    dont worry, only the part that belongs there
    Ok, just checking because in that one picture it looked like both PICs had the same writing on them.

    Now try this code:


    'RECEIVE 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

    '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 , "FR" : pause 100
    lcdout $fe , $c0 , "Shown...." , DEC3 try1 , "," , DEC3 try2 : pause 100
    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 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
    temp = 888 'hardcode transmitter to have 888 in temp space
    lcdout $fe , $c0 , "Display.." , DEC3 try1 , "," , DEC3 try2
    lcdout $fe , $80 , "Tc=" , DEC3 temp , "C,Tf=" , DEC3 tempf , "FT"
    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



    And post a fresh picture if you can
    Last edited by skimask; - 24th December 2006 at 08:36.

  36. #76
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    ok , I'm back, still no changes,
    picture up
    The two leds there are from a previous program which instead of using lcdout, I was trying to make led blink.
    but the picture was takien while your last program was working
    Last edited by lerameur; - 24th December 2006 at 13:28.

  37. #77
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    i tried this program for the reciver. The led blinks, If I added the serin , led would sit on high. There is definately a problem with serin command, It does not work with lcdout or simple led blinking

    'RECEIVE 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

    '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
    trisb=%00000000
    loop:
    lcdout $fe , $c0 , "Waiting.." , DEC3 try1 , "," , DEC3 try2
    try1 = try1 + 1 : temp = 0 : tempf = 0
    'serin portB.2 , t2400 , [ temp1 , temp2 , temp3 , temp4 ]
    Portb.4 =1 : pause 500 : portb.4=0
    Portb.3 =1 : pause 500 : portb.3=0
    goto loop
    End


    I also wanted to see if the chip was able to see the data coming in, so i tried this loop, and nothing is happening to the led:

    loop:
    serin portB.2 , t2400 , [ temp1 , temp2 , temp3 , temp4 ]
    if temp1 > 0 then
    Portb.4 =1 : pause 500 : portb.4=0
    Portb.3 =1 : pause 500 : portb.3=0
    endif

    goto loop
    End
    Last edited by lerameur; - 24th December 2006 at 14:08.

  38. #78
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Ok now I used your pogram and changed the serin line :

    serin portB.2 , t2400 , temp1 -----works

    It takes in the value,IT is NOW working. BUT For some odd reason it do not take multiple input..

    serin portB.2 , t2400 , [ temp1 , temp2 , temp3 , temp4 ] ------------- do not work

  39. #79
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default methinks

    Quote Originally Posted by lerameur View Post
    Ok now I used your pogram and changed the serin line :

    serin portB.2 , t2400 , temp1 -----works

    It takes in the value,IT is NOW working. BUT For some odd reason it do not take multiple input..

    serin portB.2 , t2400 , [ temp1 , temp2 , temp3 , temp4 ] ------------- do not work
    Hi leramuer.
    I think you need to store and retrieve those values in an array. I am not experienced enough to have confidence with this statement, but methinks it is so.
    Anyone, ring in here with an opinion!
    JS
    edit:
    try this
    Temp var byte[4]
    Temp[0] = n ' your first temp value
    Temp[1] = n1 ' your second value
    Temp[2] = n2 ' your third value
    Temp[3] = n3 ' your fourth value
    serout portB.2 , t2400,[# temp[0],# temp[1], # Temp[2], # Temp[3]]
    it displays on my backpack display.
    JS
    Last edited by Archangel; - 25th December 2006 at 07:56. Reason: add possible solution

  40. #80
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Merry Christmas to all

    I just tried that , the information is not sending. Maybe I got the code wrong, but it till skipping over the lcdout

    k

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 : 2

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