Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Synchronous Serial (bitwise ops)
Author | Message | ||||
vk4tec Senior Member Joined: 24/03/2012 Location: AustraliaPosts: 239 |
Hello One of my dream projects is to be able to handle Syncronous Serial in a PIC Synchronous serial has a clock, and data not ASYNCH - no stop and start. It relies on the user to clock in the 1' and 0's ROLL the data and worry about it. The user should then look for a pattern to "BITALIGN" with the data stream. In HDLC I think they have an idle character you are to align to, or more importantly, a pattern to lock onto to, then take 8 bits at a time. I think I can get away with it easily in Assembly langauge. 1. Look for a pin transition on the clock PIN, sample the data PIN 2. Shift and populate the next bit in an 8 bit register. 3. Look to see if that is the pattern we want ( FLAG ? ) 4. If yes, then just keep clocking in 8 bits at a time. I have read the forum and I see some Basic Language BITWISE functions requested. I think what I would need is like a ROLL or SHIFT function, and an AND operator ? My aim in the end is to go HDLC SYNCH SERIAL to Ethernet ( UDP ) - Andrew Rich VK4TEC - Andrew Rich VK4TEC www.tech-software.net |
||||
ernie Newbie Joined: 18/03/2012 Location: AustraliaPosts: 14 |
The AND operator already exits. Other bitwise operations can be done slowly in BASIC code. scripts Ultimately it depends on how fast your HDLC data is, if it's slow, you can manipulate it easily. |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3800 |
Is it HDLC or just something similar and what bit (baud) rate? The CPU chip has many I/O features and may do it all for you, depending what exactly you need. (Potentially that's RTFM lol) As well as I/O it can do DMA between memory & I/O devices. I'd say at worst plan to use C, not assembler. C should be plenty fast enough. John |
||||
vk4tec Senior Member Joined: 24/03/2012 Location: AustraliaPosts: 239 |
John, + It is HDLC - with address and control specified + It is HDLC UI frames - send and forget ( one way ) + Speed is 64 kb/s ( no start or stop bits ) + I thought Assembly or C just came down to HEX ? - Andrew - Andrew Rich VK4TEC www.tech-software.net |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3800 |
HEX seems an irrelevance (may as well say BIN). Point is, if you need more speed than MMBasic then either C or ASM will do but it's far easier to write the C and enormously easier for someone to understand it. In case you want any help there's a chance someone will be able to help if you use C. You can probably forget anyone caring about ASM for the PIC32. Have a look at the chip data sheets and you may find it can do what you want already, though HDLC isn't exactly common nowadays. If the chip can help enough then you may be able to stick with Basic. John |
||||
Print this page |