Newbie: Serial IO


Closed Thread
Results 1 to 2 of 2
  1. #1
    JamieLynn's Avatar
    JamieLynn Guest

    Default Newbie: Serial IO

    Hi all, I am new to PIC. I have some experience with the BasicStamp.

    I have been trying for the past few days to figure out the Serial IO on a PIC16F88 (unsuccessfully). I am using HyperTerminal (2400,N,8,1, No Flow control).

    I have been able to get debug to communicate with HT, but been unable to get any legible data in or out with SerIn/SerIn2, SerOut/SerOut2.

    Basically I have 2 laptops setup as described above (using serial port pin 3,5 to xmit, using pin 2,5 to RX). I have tried many variations of the below code. What is interesting (at least to me) is that When only the RX computer is connected I do get my "STARTING" message. When I connect the TX computer to the PIC I do not even get the start up message.

    Ultimately, I would like to be able to read serially computer1, process a string (terminated by CR/LF). Then output serially (not using DEBUG) to computer 2 some text based on the processed incoming data.

    I am really confused and not sure if problems are due to baud settings (I have tried many) or not comparing correctly (not really clear on if I need to use DEC or # to compare an ASCII string). Also I don't understand why I can't even see my startup line when both computers are connected.

    Should I use SerIn or SerIn2?

    TIA


    ----- CODE -------

    OSCCON = $60
    @ DEVICE INTRC_OSC_NOCLKOUT, MCLR_OFF, PROTECT_OFF, WDT_OFF
    @ DEVICE PIC16F88


    CMCON = 7 'Comparators OFF
    ANSEL = 0 'A/D OFF -- Port pins all digital

    DataIn Var BYTE

    DEFINE DEBUG_REG PORTA
    DEFINE DEBUG_BIT 4
    DEFINE DEBUG_BAUD 2400

    Input PortA.3
    OUTPUT portA.4
    PAUSE 100
    DEBUG "STARTING",13,10

    LOOP:
    Serin PortA.3,4,[DataIn]
    DEBUG "DATA ",DATAIn,13,10
    GOTO LOOP

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    JamieLynn, What is your connection to the PC's? I see that you are using inverted data for the SERIN command so that tells me that you are using the simple resistor methode for connecting to the pc for your input, however your debug configuration as a default uses true logic for the output. Please tell us of the connection so we may help.

    Dave Purola,
    N8NTA

Similar Threads

  1. Replies: 33
    Last Post: - 19th March 2010, 03:02
  2. Dynamic USB Serial Number (PIC18F4550)
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th July 2009, 17:03
  3. Question on IO ports
    By studysession in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th February 2009, 18:10
  4. PIC18F4680 to PC via MAX232 (RS232 serial) no output
    By opticsteam1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th April 2008, 20:39
  5. newbie with serial com question...
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th December 2006, 05:34

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