PDA

View Full Version : serial problem pic16F876(A)



jrt4fun
- 6th December 2004, 22:11
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

mister_e
- 6th December 2004, 22:31
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

jrt4fun
- 7th December 2004, 00:15
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,

mister_e
- 7th December 2004, 01:25
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/en/DeviceDoc/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?

jrt4fun
- 7th December 2004, 14:51
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,

Dwayne
- 7th December 2004, 15:40
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

mister_e
- 7th December 2004, 16:23
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

mister_e
- 7th December 2004, 18:54
can you just post your program header to see what u r setting in

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

jrt4fun
- 8th December 2004, 00:03
Hi guys,

Thanks already for the feedback!

Attched is the code.

Regards

mister_e
- 8th December 2004, 04:54
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 ?

jrt4fun
- 8th December 2004, 08:36
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 !!!

mister_e
- 8th December 2004, 17:47
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.

jrt4fun
- 13th December 2004, 07:33
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

mister_e
- 14th December 2004, 01:23
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...

jrt4fun
- 31st December 2004, 10:23
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.

mister_e
- 31st December 2004, 14:46
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!!!