Serin serout problem


Closed Thread
Results 1 to 40 of 337

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    yes that sit,
    Its hard to belive it works on your end.

    thats ok , i was watching mad tv...

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    yes that sit,
    Its hard to belive it works on your end.
    Well, do me a favor....
    Take that big yellow wire, follow it to the PIC on the right.
    Consult your datasheet, and tell me what pin it goes to.

    Then take that same big fat yellow wire, follow it to the PIC on the left, consult your datasheet, tell me what pin that goes to....and fix it!

  3. #3
    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.

  4. #4
    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

  5. #5
    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.

  6. #6
    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).

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

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