|
|
View previous topic :: View next topic |
Author |
Message |
Backfire
Joined: 12 Oct 2020 Posts: 46
|
Synchronous RS232 PIC16F1512 |
Posted: Tue Sep 07, 2021 7:11 am |
|
|
Hello,
I was hoping someone could advise me on an issue that I'm having.
I'm running a PIC16F1512 with an internal oscillator running at 16MHz, I have a requirement to send some serial data to a cascaded pair of latches from the devices UART. I have my latches connected so the data input to the first latch is driven by RC6, and the clock pins of my latches are driven by the RC7 pin of the PIC.
However, looking at the traces on a scope, it shows the clock line being driven at the start of data transmission, but the clock line doesn't seem to actually 'clock', it simply stays driven for around half the data frame transmission.
I'd have expected, and I require, the clock signal to be driven for each bit of the serial data frame. My #use statement is below, I'd be grateful if anyone could point out any glaring mistakes I've made!
Code: | #use rs232(stream=MIC5891, sync_master, baud=19200, xmit=PIN_C6, rcv=PIN_C7, bits=8, parity=N, stop=0, errors) |
|
|
|
PrinceNai
Joined: 31 Oct 2016 Posts: 480 Location: Montenegro
|
|
Posted: Tue Sep 07, 2021 8:06 am |
|
|
Receive pin of the PIC is an input, it won't drive anything, I guess. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Tue Sep 07, 2021 2:43 pm |
|
|
I downloaded the datasheet , as I've never used Sychronous serial...
RC6 ( TX/CK) is the CLOCK source.... [CK means ClocK]
RC7 (RX/DT) is the DATA ... [DT means DaTa ]
so you have it connected properly.
I suspect it's not being coded correctly for syncro serial in the #use RS232.
Maybe others have used it before and can comment on the correct 'configuration'.
sigh, now I'm confused... from the CCS manual....#USE RS-232(....)
SYNC_MASTER
Makes the RS232 line a synchronous master, making the receive pin a clock out, and the data pin the data in/out.
which is OPPOSITE to what the datasheet says happens......
so.... being a dinosaur... I'd cut a small program to send "Hello World' out the serial port. use a scope to SEE which pin, RC6 or RC7, is the 'clock'( steady stream of ups and downs) versus the 'data'.... |
|
|
Backfire
Joined: 12 Oct 2020 Posts: 46
|
|
Posted: Wed Sep 08, 2021 2:41 am |
|
|
Hi Temtronic,
yeah I'm pretty sure my configuration is correct (according to the CCS manual)...
I'm probably just going to implement this solution in a classic bit-bang'ed manner, as I am also a dinosaur! (Plus I'm only ever sending two bytes of data)!
Many thanks for looking over it, you've put my mind to rest at least! |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Wed Sep 08, 2021 5:26 am |
|
|
I'd go with the uChip datasheet for correct config ,both hardware and registers. CCS could have swapped the names....oopsy.
Pretty easy to do the small test, just don't forever loop to send 'U' !! That looks like a 'clock ' signal !! Though it makes it easy to see the bit width of a serial data stream....
Jay |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|