TX problem


Closed Thread
Results 1 to 6 of 6

Thread: TX problem

  1. #1
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425

    Default TX problem

    Hi,

    I used this program on a 16F876 and it worked with no problem. I went to a 16F688 because I just needed a PIC with a USART port and less pins. Below is the code but it stops at the point where HSEROUT is. Can anyone help with it?

    DEFINE HSER_BAUD 2400
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_CLROERR 1


    Define ADC_BITS 10 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uS
    ADCON1 = %10000010
    TRISC = %11000010
    TRISA = %11011111
    ANSEL = %10000000
    CMCON0=7
    b1 var BYTE
    b2 var BYTE
    b3 var BYTE
    sum var word

    mainloop:
    IF PORTC.1=0 THEN SEND
    GOTO MAINLOOP

    send:
    B1=0
    B2=1
    B3=0
    sum = b1+b2+b3
    HIGH PORTC.2
    PAUSE 100
    LOW PORTC.2
    HIGH PORTC.0
    pause 50
    HSEROUT [0,b1,b2,b3,sum.byte0] <---This is where the code stops.
    PAUSE 50
    LOW portC.0
    HIGH PORTC.2
    PAUSE 1000
    LOW PORTC.2
    B1=0
    B2=0
    B3=0
    GOTO MAINLOO

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Christopher,
    Code:
    DEFINE LOADER_USED 1
    The reason I suspect that is because in the .LST file, it shows HSEROUT as being in program address 0001h. If you are using a bootloader and not DEFINEing it, the first 3 words of HSEROUT will be lost. Causing it to jump into La-La Land.
    <br>
    DT

  3. #3
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default

    Darryl,

    I tried what you said but it still works the same. I am so frustrated that this works on the 876 but I can't get it to work on the 688. BTW, at the end of the code it says "goto mainloo" but it should say "goto mainloop." This is just a typo. Anyway, do you have any other ideas?

    Thanks,

    Chris

  4. #4
    Join Date
    Aug 2005
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    What clock speed are you running it at?

    Worth adding a
    DEFINE OSC with your value of clock you running.

    If using internal Clock then if I remember right the 16F688 runs at 8mhz and if you have not Defined a clock speed PBP will default to 4mhz

    Regards

    Sean.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Download the latest patch to fix this one. http://www.melabs.com/support/patches.htm

    Without the patch HSEROUT/HSERIN do not work with this series. Microchip decided to shift the USART config registers (and a few more) into different file register banks.

    I guess Microchip just likes to keep 3rd party compiler developers on their toes...:}
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default

    Yup, this fixed the problem! Thanks for the help, I should have checked for updates.

Similar Threads

  1. PIC or xbee times out after Tx 504 bytes
    By archendekta in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 23rd November 2009, 08:45
  2. PIC16F877A analog problem
    By DeViLa_Q8 in forum mel PIC BASIC
    Replies: 0
    Last Post: - 30th July 2009, 20:19
  3. byte Tx w/ USART 16f876a problem
    By GargamelDigi in forum mel PIC BASIC
    Replies: 2
    Last Post: - 15th July 2008, 05:50
  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. 1 slave 1 master 1 MAX232 1 problem ?
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 31st July 2005, 22:59

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