PBP 16F876A 2 Way Communication


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Something like -


    LoopTop:

    If PIR1.5 = 1 THEN ' Check to see if Character was received
    HSERIN[Char] ' Grab the character out of the UART
    HSEROUT [ADVAL] ' Send the last A/D value
    ENDIF

    ADCIN 1, ADVAL ' Continuously sample the A/D

    GOTO LoopTop

    ;---------------------------------------------------------------

    PIR1.5 will be set (to "1") whenever ANY character has been received
    in the USART. HSERIN grabs that character and sets PIR1.5 to "0" at
    the same time. Then it sends the A/D value out.

    If no character is received, the A/D converter converts merrily along...
    Charles Linquist

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


    Did you find this post helpful? Yes | No

    Default

    Steve

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

  3. #3
    dmugan's Avatar
    dmugan Guest


    Did you find this post helpful? Yes | No

    Default PBP 16F876A 2 Way Communication

    Thank you Charles Linquis and Mister E. Both of your suggestions were helpful. I have incorporated your suggestions in the program below, but I get an error when the compiler reaches the HSERIN command.

    ERROR Line 38: Expected '['.

    I have tried many different ways to confugure the HSERIN command, but always get this or sometimes additional errors. Any suggestions?

    Thanks again for your help.

    DEFINE ADC_BITS 10
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 10
    adcVar VAR WORD
    TRISA = %11111111
    ADCON1 = %10000010
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLOERR 1
    PAUSE 005

    main:
    If PIR1.5 = 1 THEN
    HSERIN[char]
    HSEROUT [DEC adcvar, 10, 13]
    ENDIF
    ADCIN 0, adcVar
    PAUSE 50
    GOTO main

  4. #4
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    I think you forgot to declare "char"
    char var byte

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,174


    Did you find this post helpful? Yes | No

    Default

    And put a space before '['

    Ioannis

Similar Threads

  1. 2 PIC, serial communication
    By lightgreen in forum Serial
    Replies: 6
    Last Post: - 21st November 2009, 16:20
  2. Help with 2 way communication
    By jessey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 22nd April 2007, 10:11
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 18:27
  4. PIC 2 PIC communication
    By Mario in forum Forum Requests
    Replies: 16
    Last Post: - 28th April 2006, 02:56
  5. hpwm more than 2 ch possible in pbp?????????
    By oscar in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 10th March 2006, 08:28

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