![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | Thread Tools | Display Modes |
| | (permalink) |
| New Member | hi all, lets say i have a pic16f877 with some 9 bit data stored in its registers... can i send these data to a PC running windows OS through the serial port... i have to use C++ pogramming on the PC side... how do i go about it....?? any tutorials or even ready templates i can use...??? thanks a million |
| | |
| | (permalink) | |
| Super Moderator | Quote:
If you really want to transfer 9 bits, you will probably need to do it as two bytes - a single byte is normally only 8 bits, although you could use non-standard methods. | |
| | |
| | (permalink) |
| Experienced Member | By 9bit data do u mean 8bit + parity? rs232 is an 8bit "data-space" protocol, you could do something clever with the parity bit, but most computers have hardware USART decoders, and you might find it automatically discards the "deffective" parity bit. |
| | |
| | (permalink) |
| Experienced Member | serial is the simplest interfacing to PC well.. i just connect 3 wires, Ground, Transmit, Receive handshaking is not necessary hmm... now i'm interested to interface parallel port.. ehh... but kind of lazy to do some study.. besides 8 data pin, what other necessary pin i need to connect from parallel port to PIC?? ignore those Out of Paper pin..etc.. |
| | |
| | (permalink) |
| Experienced Member | If you want to use the parallel port in SPP mode (standard mode, least programming hassle) then those 8 data bits are only output, for input into the pc you can use the other signals like out of paper, online, ... do a search on google, comes up with lots ot results about pinout and the right registers to adress |
| | |
| | (permalink) |
| New Member | i realsie the 16f877 had got built in USART capabilities... now i wanna use the asyn. mode....mainly to transmit data out of my pic to a pc...here are my questions: 1. if i had loaded the data into the TXREG register, can i proceed to carry out other instructions? will the transmitting carry out in the background, or do i have to wait till the byte is transmitted b4 carrying on? 2. the pic16f877 has both transmit and receive pins....are they independent of each other? 3. i f i wanna interface to a pc serial port, is it necessary to setup handshaking ?? 4. anyone can help me with C++ serial port prggramming ?? like wat functions are available??...i dun need the GUI... just running in MSDOS shell would be fine.... thanks again. |
| | |
| | (permalink) | |
| Super Moderator | Quote:
2. As far as I know yes, you can use either or both. 3. Handshaking is completely optional, only needed is you are sending large quantities of data very fast - in which case you need to pause the transmitter while the receiving end catches up. If you are writing both ends of the link it's no problem at all, simply send the data in smallish packets - initiated by the receive end. 4. No idea, I don't use C or C++ - if you want Turbo Pascal serial port help, I'm your man!. | |
| | |
| | (permalink) |
| New Member | hi all, can i just connect my PIC pins to the serial port directly ??? is the voltage levels compatiable ?? if i can connect them directly, do i connect my TX (PIC) to RX (PC) and RX (PIC) to TX (PC).... and lastly, the GND(PC) to a common gnd with the PIC ?? thanks |
| | |
| | (permalink) | |
| Super Moderator | Quote:
A MAX232 is a common chip used to convert from RS232 (and is the one used in my tutorial), but you can do it crudely with a couple of resistors, this is how the BASIC Stamp does it!. | |
| | |
| | (permalink) |
| Experienced Member | Although the RS232 levels are different fromt he 0-5V level that the PIC uses you can connect the PIC to the serial port. One thing is that the connection might not be standard, for debugin purposes is perfect. The lenght of the cable can't be too long, the longest I have used is about 5-6 feet. No trouble what so ever. The highest baudrate I have used is 19200. Your connection should have a limiting resistor, a 2.2K will be good... I normally just connected straight, without any trouble. It works because of the clampind diodes of the PIC, that allows to read the -12v to +12V swing. The serial port even in my 486 laptop recognize the 5-0V levels.... one thing to have in mind to send serially with the PIC connected to the PC you have to send the data inverted..... if you use a MAX232 you send the data no-inverted (true mode). Ivancho |
| | |
| | (permalink) |
| New Member | MAX232 or DS275: Translates RS-232 signal levels to common CMOS/TTL levels. Can it translate CMOS/TTL into RS-232? |
| | |
| | (permalink) |
| New Member | Do we need specific software to extract or copy information from the PIC? |
| | |
| | (permalink) |
| New Member | The MAX232 and the DS275 go both ways. One set of pins will go from RS232->TTL and another set will go from TTL-> RS232. As for software to capture serial information, I like using Real Term http://realterm.sourceforge.net/. It looks complex but you can ignore 80% of the settings. |
| | |
| | (permalink) |
| New Member | Thanks. Anyway, can I use USB instead of serial transfer? |
| | |
| | (permalink) |
| Experienced Member | Yes you can use USB if (a few possibilities, choose one) : a) use USB to RS-232 adapter. b) use USB to RS-232 chip (like the one from FTDI) c) use a PIC micro with USB support (PIC18F2455, PIC18F4550 .... etc) Petr |
| | |