I need help with pic 16F876A. please help me

Status
Not open for further replies.

rose rose

New Member
hi everybody

I use pic 16F876A which contain ADC in designing DPCM but when i programmed it in pic basic pro i have problem that the output of pic parallel. i need to know how convert it to serial when i programmed it???? after that how can i use XOR logic in same program also??to convert PCM to DPCM.
 
What kind of DPCM, Biphase? Manchester? Are you generating the clock or reading one?

And maybe most important - what is your bitrate? Since there's no support for DPCM in the 16F876, you are going to have to try and bit-bang it. Unfortunately, if your bitrates are too high there won't be enough time.

Generally, you would set up a timer for an interrupt per bit. On interrupt, immediately reload the timer, check to see if you need to transmit a frame synch, fetch the AD data if it's ready (and restart it and subtract the new AD data from the old one to get the difference), increment or reset a bit-position-count for the data currently being transmitted, toggle the clock, toggle output bit on the data bit changes, and return.
 
Last edited:
thanks
i do this steps below in the program but the program not complete
Res var word
TRISA=1
TRISB=0
ADCON=0
ADCON0=%11000001
AGAIN:
ADCON0.2=1
WTAUSE1
IF ADCON0.2=1 THEN WT
Res=ADRES
Res=PORTB

help me by complete it please
this program upon just generate pcm and parallel output i will convert parallel to serial in program then apply XOR on them
 
I'm not familiar with that compiler, but don't you want that last line to be PORTB=Res ? Looks like you are redefining Res instead of sending it out the port.

Also, you have an ADRESH and ADRESL in the '876, not ADRES.

Your ADCON0 reg seems to be configured correctly, and you seem to be doing the start bit ok, but you don't have ADCON1 - just ADCON.
 
Also "res" ends up with the value of PORTB instead of the other way round. And! "res" is an mpasm reserve label you shouldn't use it. Rename res to result..
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…