Serin Problem 16f819


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2007
    Posts
    14

    Default Serin Problem 16f819

    I have a 16f819 hooked up to a rf ZIGBEE transceiver and had both the serout and serin working a couple of days ago. I have another transceiver hooked up to a laptop and using hyperterminal to communicate with the pic. All of the sudden serin stopped working. I've tried on different pics to no avail. Here is the code that is running on the pic. Is there something I'm overlooking. It's especially frustrating because it worked a few days ago. However, some slight code modifications have been made, but nothing I thought that would affect the serin command. Serout works just fine and I'm getting all the data on hyper terminal

    INCLUDE "MODEDEFS.BAS"
    'INCLUDE "BS2DEFS.BAS"
    @ DEVICE HS_OSC,MCLR_OFF,BOD_OFF
    define CHAR_PACING 1000
    DEFINE OSC 4
    DEFINE SHIFT_PAUSEUS 100
    OSCCON=$60
    ADCON1=6
    SERIN_DATA VAR BYTE
    TRISB.0=1
    HIGH PORTA.4

    begin:
    SERIN PORTB.0,T9600,4000,cont,SERIN_DATA
    SEROUT PORTB.4,T9600, ["Got the Value: ", SERIN_DATA,13]
    IF SERIN_DATA[0]="S" THEN
    HIGH PORTA.3
    ENDIF
    IF SERIN_DATA[0]="F" THEN
    LOW PORTA.3
    ENDIF
    CONT
    SEROUT PORTB.4,T9600, ["Still wainting ",13]

    goto begin

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


    Did you find this post helpful? Yes | No

    Default

    You defined a HS osc... it's suppose to be for a XTAL>4MHZ... but it souldn't be the main problem

    OSCCON do nothing here as you're using an external one

    You NEVER EVER tell to disable the LVP mode

    9600 baud @ 4mhz will NEVER work unless you're using the PIC USART or maybe DEBUG in worst case. There's a BIG warning in the fabulous manual about that.

    Code:
    DEFINE SHIFT_PAUSEUS 100
    is useless
    Steve

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

  3. #3
    Join Date
    Mar 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    This code was taken from larger code. I just wanted to isolate the serin and serout commands. that is why some of the configuration lines are still in the code. What is LVP mode? You say that you cannot run 9600 baud w/ a 4MHz crystal. Would this also apply to serout, because I have had no problems with that at all.

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


    Did you find this post helpful? Yes | No

    Default

    Don't use SERIN/SEROUT/SERIN2/SEROUT2 @ 9600 bauds @ 4MHZ. DEBUG may work better. BUT HSERIN/HSEROUT will works a treat... on the right pins.

    Use the PicMultiCalc to generate the right HSERIN/HSEROUT DEFINEs

    http://www.mister-e.org/pages/utilitiespag.html

    LVP mode HAVE TO BE DISABLED.
    Steve

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

Similar Threads

  1. Serin Problem with 12F629/PBP
    By Flyingms in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 9th March 2009, 14:59
  2. Serin serout problem
    By lerameur in forum mel PIC BASIC Pro
    Replies: 336
    Last Post: - 6th February 2007, 04:25
  3. Problem with PBP interrupt and Serin, please help
    By rgregor in forum mel PIC BASIC
    Replies: 0
    Last Post: - 22nd August 2006, 19:02
  4. serout and serin problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th April 2006, 19:44
  5. 16F877A serin problem with baud rate 19200
    By leemin in forum Serial
    Replies: 1
    Last Post: - 31st July 2005, 09:45

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