SERIN2 not working with 16F628


Results 1 to 4 of 4

Threaded View

  1. #1
    d1camero's Avatar
    d1camero Guest

    Default SERIN2 not working with 16F628

    I have searched long an hard in the datasheets, forum and archive, but I am unable to get my 16F628 to receive any data from a 12F675 with SERIN2.

    I have the 16F628 acting as a master, with a 12F675 being the slave unit. The 628 sends a bit of data, then does a SERIN2 WAIT. The slave receives the data and replies back with a number.

    I have connected a logic analyzer, and the data is being sent from the master to slave and the slave is responding. The Logic analyzer interprets the data correctly at 2400 8N1. Yet the 628 master times out.

    Things to note:
    <ul>
    <li>16F628 is using an external 10Mhz resonator
    <li>Programmer for 16f628 is a ISP Pro 0818
    <li>12F675 is using a <b>calibrated</b> internal oscillator
    </ul>

    I have reduced this down to small test programs. Here is the 16F628 master code:

    <table border=1><tr><td>
    <code>
    @ Device PIC16F628,WDT_ON,PWRT_ON,PROTECT_OFF,MCLR_ON,BOD_O FF,LVP_OFF, CPD_OFF

    DEFINE OSC 10

    DEFINE CHAR_PACING 2400

    DEFINE DEBUG_REG PORTB
    DEFINE DEBUG_BIT 2
    DEFINE DEBUG_BAUD 2400
    DEFINE DEBUG_MODE 1

    Counter var Byte

    debug "Initializing...",13,10

    CMCON = %00000111
    TRISA = %00000010
    TRISB = %00000000
    VRCON = %00000000
    INTCON = %00000000
    RCSTA = %00000000
    TXSTA = %00000000
    SPBRG = %00000000

    pause 1000

    loop:

    pause 1000
    debug "Sending to slave...",13,10

    ' send out some stuff
    SEROUT2 porta.0, 16780, ["hello"]

    ' wait and read
    SERIN2 porta.1, 16780, 300, TimeOut, [WAIT("SYNC"), Counter]
    DEBUG "Got from slave:", DEC Counter, 13, 10

    Timeout:
    DEBUG "Timeout from slave", 13, 10

    goto loop


    </code>
    </td></tr></table>

    Here is the 12F675 slave code:

    <table border=1><tr><td>
    <code>
    @ Device PIC12F675,WDT_ON,PWRT_ON,PROTECT_OFF,MCLR_ON,BOD_O FF 'sets configuration

    Counter var byte

    CMCON = %00000111
    TRISIO = %00000000
    ANSEL = %00000000

    Pause 100

    Counter = 0
    loop:
    Serin2 gpio.2, 16780, [WAIT("hello")]
    PAuse 2
    SEROUT2 gpio.4, 16780, ["SYNC", Counter]
    Counter = Counter + 1

    goto loop
    </code>
    </td></tr></table>

    A JPG of the Logic Analyzer is attached. Your help is very much appreciated.

    thanks
    Don
    Attached Images Attached Images  

Similar Threads

  1. GPS $GPRMC to PIC16F684. Need help with SERIN2
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 27th November 2009, 09:47
  2. LOW PORTA cause serin2 not working.
    By mikewen in forum Serial
    Replies: 7
    Last Post: - 28th August 2009, 04:18
  3. Getting SERIN2 to work?
    By BobPigford in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 22nd July 2009, 20:10
  4. SERIN2 digit parsing
    By skimask in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th January 2007, 23:15
  5. Hserin not working...
    By robert0 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 22nd August 2005, 12:25

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