USART SPI problem !


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2007
    Posts
    2

    Unhappy USART SPI problem !

    Hi,

    I am new to this forum and I have been reading some of the posts and it seems that there are a lot of knowlegeable and helpful people.

    I am currently working on a project that involves using the USART on a pic16F876a with the function HSEROUT. I wrote a simple program in PICBASIC using the HSEROUT command to send a HEX value to a PC's serial port. I am using a serial port monitor program on the PC that can receive and send data. The problem is that the pic16f876a sends a hexadecimal value (ex. $FF) to the PC and the PC receives a different HEX value. This is the code I wrote:

    @ device pic16F876a, hs_osc ' oscillator selection
    @ device pic16F876a, hs_osc ' oscillator selection
    @ device pic16F876a, wdt_off ' watchdog timer
    @ device pic16F876a, pwrt_off ' power-up timer
    @ device pic16F876a, bod_off ' brown-out reset
    @ device pic16F876a, lvp_off ' low-voltage programming
    @ device pic16F876a, cpd_off ' data eeprom protection _off
    @ device pic16F876a, wrt_off ' flash program memory write
    @ device pic16F876a, protect_off ' program code protection _off


    define OSC 20

    workA VAR BYTE

    DEFINE HSER_BAUD 9600 ' Select the baud rate
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_SPBRG 129

    char var byte ' Storage for serial character


    loop:
    pause 200

    HserOUT[HEX $FF]

    goto loop

    I am using a 20MHz crystal. If anyone could take a look at the code I would appreciate any suggestions as to what could be wrong. Thank you in advance for your response.

    TripleS

  2. #2
    Join Date
    Oct 2007
    Posts
    2


    Did you find this post helpful? Yes | No

    Default

    Anyone? Please???

Similar Threads

  1. byte Tx w/ USART 16f876a problem
    By GargamelDigi in forum mel PIC BASIC
    Replies: 2
    Last Post: - 15th July 2008, 05:50
  2. 16-bit SPI problem
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th June 2008, 15:42
  3. SPI communication problem (newbie)
    By lm555cn in forum Serial
    Replies: 4
    Last Post: - 3rd March 2008, 15:33
  4. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  5. problem with USART
    By leemin in forum Serial
    Replies: 4
    Last Post: - 11th December 2006, 17:56

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