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

    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

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

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

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

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

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

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

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

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

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