Serial Communication


Closed Thread
Results 1 to 5 of 5
  1. #1
    morris's Avatar
    morris Guest

    Default Serial Communication

    I am trying to build a robot through a college experiment. We are using two Pic16F628A microcontrollers. The problem that we are having is that the first pic is using a serial function to communicate through an infrared led. This led sends the modulated signal to a ir reciever. In turn, this circuit sends the signal to another Pic. This is where our problem is... this pic isn't sending the serial message to the LCD like we want it to. Does anyone have any suggestions on the commands that we could use in attempt to get this working?

    This is the current program that we have and are trying to use to get this working...

    TRISB=%00010000

    Include "modedefs.bas"
    B0 var byte

    PAUSE 500

    LCDLoop:
    Serin2 PORTB.4, T2400, [B0]
    lcdout $FE, 1
    LCDOUT $FE, 2
    LCDOUT B0
    GOTO LCDLoop

    END

    Please.. if anyone can help please do so
    Last edited by morris; - 14th December 2006 at 16:08.

  2. #2
    skimask's Avatar
    skimask Guest

    Default

    In your original code, you displayed the character, then reset the LCD, then displayed the character. Sounds to me like the LCD is clearing itself before you actually get to see it.

    Small steps, get the individual core PICs working first, LCDs, buttons, motor control, etc. Then start adding the extra stuff.

    If you're asking this type of question here on a forum AND you're doing this for a 'college level experiment', it sounds to me like your instructor sucks and you'd better get your money back.
    JDG

  3. #3
    morris's Avatar
    morris Guest

    Default thanx

    appreciate man... i agree 100% with the last part... ill try your suggestions... thank you

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

    Default as per skimask

    Quote Originally Posted by morris
    I am trying to build a robot through a college experiment. We are using two Pic16F628A microcontrollers. The problem that we are having is that the first pic is using a serial function to communicate through an infrared led. This led sends the modulated signal to a ir reciever. In turn, this circuit sends the signal to another Pic. This is where our problem is... this pic isn't sending the serial message to the LCD like we want it to. Does anyone have any suggestions on the commands that we could use in attempt to get this working?

    This is the current program that we have and are trying to use to get this working...
    Code:
    TRISB=%00010000
    
        Include "modedefs.bas"
    B0 var byte
    
    PAUSE 500
    
    LCDLoop:
    Serin2 PORTB.4, T2400, [B0]
    lcdout $FE, 1       ' clears display
    LCDOUT $FE, 2     ' returns curser home
    LCDOUT B0         ' displays variable's contents 
     PAUSE 1000  '     makes time to read lcd
    GOTO LCDLoop     ' returns to beginning of loop
    
    END

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    The PAUSE 1000 above is handy if you want to loose incoming data

    So do you have any information how the data is modulated and sent? Do you have any access to the it's source code or not? If the baudrate and mode are good, use a scope an look if you see anything going out of your IR receiver. If at least you have some signal, it could be the accuracy of it.

    Let's say you're using internal OSC on both side (transmitter and receiver) and both are a little bit out of range.. there's no chance to have something good at the end.

    If you're using the default LCD pin assignement, you need to disable the analog comparator on PORTA or your LCD will probably never work
    Try this one bellow and post your results
    Code:
        '
        '    PIC Configuration
        '    =================
    	@ __CONFIG  _INTRC_OSC_NOCLKOUT  & _MCLRE_OFF  &  _LVP_OFF & _WDT_OFF & _PWRTE_ON  & _BODEN_ON  
            
        '
        '    Hardware configuration
        '    ======================
        PORTA=0
        PORTB=0
        TRISA=0
        CMCON=7         ' Disable analog comparator
        TRISB=%00010000 ' RB4 as input (Serial comm)     
    
        '   
        '    Variables definition 
        '    ===================
        B0      var byte
        
        '
        '    Constants definition 
        '    ====================
        Include "modedefs.bas"
        
        '
        '    ////////////////////////////////|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\        
        '                             Program Start Here                               
        '    ////////////////////////////////|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\        
        '    
        PAUSE 500
    
    LCDLoop:
        Serin2 PORTB.4, T2400, [B0]
        lcdout $FE,  1,"N:",B0," D:",DEC b0
        GOTO LCDLoop     ' returns to beginning of loop
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Wireless serial communication question
    By Ahmadabuomar in forum Serial
    Replies: 3
    Last Post: - 21st December 2009, 03:49
  2. PIC to PIC "wired" serial one-way communication - SERIN2/SEROUT2
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 14th April 2008, 20:02
  3. Bootloader,MCSP and Serial communication
    By surfer0815 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd March 2006, 10:52
  4. Serial Communication using 12F629
    By charudatt in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 14th March 2005, 04:24
  5. Replies: 8
    Last Post: - 11th November 2004, 20:08

Members who have read this thread : 1

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