hserout PIC pic 16F876


Results 1 to 8 of 8

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    Apologize for poor english , i was a bad boy at school ...
    Vincent
    don't be afraid of that...

    Everything is ok in both speed, but i can't switch from one to another ...

    It seems that new define are not allowed during execution ...

    And writing to regsiter seems to confuse HSEROUT ...
    can you something for me. I'm not sure it's gonna work but... worth a try

    Let's assume you have a 20MHZ crystal.

    Refer to the table 10-4:
    SPBRG=129 '@9600 bauds
    SPBRG=64 '@19200 bauds


    IMO we can change the baud rate only by changing the value of the SPBRG register.

    so give a try to this snipet

    Code:
    DEFINE OSC 20
    
    start:
         TXSTA=$24
         RCSTA=$90
         SPBRG=129  '@9600 bauds
         pause 100 'try to remove this pause after
         HSEROUT ["comm @9600 bauds"]
         TXSTA=$24
         RCSTA=$90
         SPBRG=64  '@19200 bauds
         PAUSE 5000 'wait 5 seconds
         HSEROUT ["comm @19200 bauds"]
         goto start
    let me know... i'm curious.

    If it's working, try to define TXSTA and RCSTA only one time at the begining to see if it's also work.

    Code:
    DEFINE OSC 20
         TXSTA=$24
         RCSTA=$90
    
    start:
         SPBRG=129  '@9600 bauds
         pause 100 'try to remove this pause after
         HSEROUT ["comm @9600 bauds"]
         SPBRG=64  '@19200 bauds
         PAUSE 5000 'wait 5 seconds
         HSEROUT ["comm @19200 bauds"]
         goto start
    Last edited by mister_e; - 2nd February 2005 at 18:09.
    Steve

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

Similar Threads

  1. I2C Slave with a PIC
    By ralfmayr in forum mel PIC BASIC Pro
    Replies: 129
    Last Post: - 21st August 2016, 17:44
  2. HSEROUT and Commas, What? Help Me Understand
    By altech6983 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th July 2009, 19:12
  3. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 14:46
  4. Is HSEROUT corrupting bit 7 ?????
    By Robert Wells in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd October 2008, 16:26
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

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