On Sat, 5 Jan 2002 22:51:15 -0500, Byron A Jeff wrote: >On Sat, Jan 05, 2002 at 06:54:08PM -0800, Bob Barr wrote: >> On Sat, 5 Jan 2002 20:11:20 -0500, Andy Meng wrote: >> >> >Hello, >> > >> >I am working on a Windows program using C++ to talk to a PIC. The PIC= is >> >using 9-bit serial mode (the PC is simulating one side of what will >> >eventually be two PICs communicating over an RF link), but it seems = that the >> >PC serial port can do only 8 bits. Is this true? Is there a way to = get >> >around this? >> > >> >> I don't know the specifics of the C++ interface code but, in >> Hyperterm, the 9th bit can be set to odd parity, even parity, mark, >> space, or none. You'll probably find a similar capability in your C++ >> documentation. > >Which makes it pretty much useless for this application. > True, it's useless with Hyperterm but not when writing your own C++ code for testing. >> >> Switching between mark and space could get a bit messy if you want to >> use the 9th bit as a data bit. Are you using it for data or for parity >> checking? > >The 9th bit is an address/data bit. When set it indicates an address = that >the packet it targeted for. Reset indicates data. > >The usefulness on the PIC is that that its USART can be configured to = generate >an interrupt only if an address is sent. So the basic gameplan when you = have >multiple nodes on the line: > >- Everyone sets up to just accept addresses. >- When an address is sent everyone is interrupted and checks the = address. If the > address doesn't match, when go back to accepting addresses only. >- However if the address does match configure the USART to accept data. > >So once a matching address is sent, only the targeted station will = receive the >data. All the other stations will ignore the line until another address = is >sent. > >This issue comes up time to time on the list. Personally I always = thought the >best tack was to attach the PC to a PIC which does 9 bits to the rest of= the >network and uses a 8 bit software UART to talk to the PC. By the time = you >finish contorting your Windows code to mangle the PC UART to simulate 9 = bit >mode, you will have pulled all your hair out of your head. > >Since your final target is 2 PICs anyway, why waste time trying to get a= PC >to simulate? > Thanks for clarifying the application. I hadn't realized that the PIC's UART had that capability. Of course, I haven't implemented any multi-node PIC networks either. :=3D) Since the 9th bit can be set to a mark or a space in the PC, all that needs to be done in the C++ code is set it to mark for the addresses and switch it to space for the data bytes.=20 Regards, Bob -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body