serial problem pic16F876(A)


Closed Thread
Results 1 to 16 of 16
  1. #1
    Join Date
    Apr 2004
    Posts
    34

    Angry serial problem pic16F876(A)

    Hello,

    In my code I use this line to receive some data.

    main: Serin2 RxD,baud,[wait(Sync),Destination]

    RxD is the portc.7

    Now when I use a pic16f876A the code is working perfectly. However when I use the same code on a pic16f876 the program is not working at all.

    Does anyone of you know what is wrong?

    Thank you.

    Best regards

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


    Did you find this post helpful? Yes | No

    Default

    Be sure you compile with the great device
    Be sure you programming with the right device too

    look to the datasheet... may have difference between these two. Do a search at the microchip website. There's certainely some '876 to '876a migrating reference for those
    Steve

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

  3. #3
    Join Date
    Apr 2004
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Steve,

    thanks for your reply.
    I had already a look to the website of Microchip but couldn't find anything about the serial part (or uart).

    When I change the RxD to another pin using the same serin2 comand it doesn't mather if I'm using a 876 or 876A.

    Regards,

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


    Did you find this post helpful? Yes | No

    Default

    just wonder if you're using internal USART... if you using SERIN2 it will not use the internal one only software...


    migration document here
    http://ww1.microchip.com/downloads/e...Doc/39591a.pdf


    but i don't see any difference on PORTC...

    what about if you use a correct HSERIN statement instead of SERIN2???

    what is connected to PORTC.7?
    Last edited by mister_e; - 7th December 2004 at 01:28.
    Steve

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

  5. #5
    Join Date
    Apr 2004
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Steve,

    I also tried it with the HSERIN command same effect here.

    The component I have conected to the portc.7 is the output of a max485 (rs485 driver).

    Regards,

  6. #6
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Jrt4fun,

    Jrt>>Now when I use a pic16f876A the code is working perfectly. However when I use the same code on a pic16f876 the program is not working at all.<<

    My first step, would be to write a blinky to verify your pin is good.

    Are the clock speeds the same?
    Are you running 9600 on a 4mhz chip?
    Can you verify your receive pin is ok?
    Can you verify your tranmit pin is still working?
    Is the pin grounded with a 5k resister?
    Is the new pin a I/O pin?

    Dwayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

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


    Did you find this post helpful? Yes | No

    Default

    Hi Dwayne,

    F876a is *suppose* to be pin compatible with F876. The only difference i see is the new implement of analog comparator on PORTA wich are off as default setting when powering PIC up.


    jrt4fun
    BUT wich crystal do you use? is the PIC number match to this PIC capability i.e. PIC16f876-OSC.... sure yes but... may happen.

    do you receive some messy data or nothing from this pin??? I'm sure pullup resistor will do nothing but can try... i heard a few time problem with this PORTC... i'll try with some F877 i've here. i'll also get one F877a to see if there's something different on this PORTC.

    i'll let you know
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    can you just post your program header to see what u r setting in

    TRIS,define.....variables...
    Steve

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

  9. #9
    Join Date
    Apr 2004
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Hi guys,

    Thanks already for the feedback!

    Attched is the code.

    Regards
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default

    o.k when you program the F876 did you change your DEVICE lines to DEVICE pic16f876 ???

    also the following define are not good for F876 if i refer to the p16f876.inc and p16f876a.inc files


    @ DEVICE pic16F876A, PWRT_OFF
    ' Power-On Timer
    @ DEVICE pic16F876A, BOD_ON
    ' Brown-Out Detect
    @ DEVICE pic16F876A, PROTECT_OFF

    so they probably refer programmer to something else. Must see p.16f876.inc files in your MPLAB\mchip_tools

    I saw in the migration sheet that theres some difference on programming method/timing. Also when programming did you select the good device (since F876 is not suppose to be the same am F876A)

    can you try slower baudrate ?
    Last edited by mister_e; - 8th December 2004 at 04:57.
    Steve

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

  11. #11
    Join Date
    Apr 2004
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Hi,

    I payed extra attention to the point you just mentioned about the device lines. Also during compiling and programming I made sure the right components have been selected.

    What I certainly will try is to remove the device settings that are not applicable to the 876 and to give it a go on a slower baud rate.

    I will keep you posted.

    Thanks !!!

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


    Did you find this post helpful? Yes | No

    Default

    What I certainly will try is to remove the device settings that are not applicable to the 876 and to give it a go on a slower baud rate.
    in fact they're applicable but you must write different

    example you write
    @ DEVICE pic16F876A, PWRT_OFF
    ' Power-On Timer

    But F876 use this one
    @ DEVICE pic16F876A, PWRTE_OFF

    anyway, can try to remove them and set them manually. All fuse setting are in the according .inc file... at the end of it.
    Steve

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

  13. #13
    Join Date
    Apr 2004
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Hi guys,

    Unfortunately no joy.
    I removed all config settings an d set manually on the programmer software but this didn't change a thing.

    Could it have something to do with the programmer or rather with the software used?
    I use IcProg (http://www.ic-prog.com/index1.htlm)

    Regards

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


    Did you find this post helpful? Yes | No

    Default

    What about if you set TRISC.7=1
    should be set to input at power up but...


    also what about if you define BAUD and Sync like this

    BAUD VAR BYTE
    Sync VAR BYTE

    BAUD=84
    Sync=254


    Is a simple Led Blink on this pin works ?

    still really weird if nothing's working now...
    Last edited by mister_e; - 14th December 2004 at 01:31.
    Steve

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

  15. #15
    Join Date
    Apr 2004
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Greetings,

    This just to inform you that I had the pic verified by a friend of mine with another programmer and it gives the same result.

    Tried to make a simple led blink as you suggested and this failed as well.

    So I can assume that the pin RC.7 is quite 'dead'.

    Thanks guys for all the info and effort...

    Best regards.

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


    Did you find this post helpful? Yes | No

    Default

    Dooo... one I/O less now!!! That's happen sometimes. Great to know that was the problem then.

    Also glad to heard it wasn't special cached feature of this PIC. That's clear out some idea i got.

    Happy new years to you and everybody here!!!
    Steve

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

Similar Threads

  1. Replies: 5
    Last Post: - 20th March 2006, 01:34
  2. Serial Communication Problem
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 23rd February 2006, 02:11
  3. Y A Serial problem
    By jswayze in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 2nd December 2004, 04:40
  4. Replies: 8
    Last Post: - 11th November 2004, 20:08
  5. 16F877, DS18S20 and Serial Comm Problem
    By YellowTang in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th April 2004, 10:36

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