![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
Hi all, I am very new to microcontrollers,and I bought a Zilog Encore XP dev board. I need to interface it with a compass module using a uart port. I have tried to do it but have had no success yet. I have initialised uart1, using the api, and enable the receive interrupts. I get an interrupt, and status register errors even if nothing is even connected to the port pins. I also get errors if the module is connected. Am I meant to have pull-up/down resistors in place? The compass module is a TTL module but requires 5v input - might I need a level converter? What would be the normal start-up sequence for something like this - initialise everything, then apply power to compass module (it will start transmitting compass headings in continuous mode by default)? Sorry if I have confused anyone, I am a little desparate Cheers, Rob | |
| |
| | #2 | |
| Quote:
![]() I am assuming that the Zilog is operating with a +5V supply.? If you have a link to the dev board circuit please post it.
__________________ Eric " Good enough is Perfect " I will NOT answer PM's requesting technical help, please use the Forum PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/ Last edited by ericgibbs; 20th July 2009 at 08:13 AM. | ||
| |
| | #3 |
|
Hi Eric, Here is the dev board manual: http://www.zilog.com/docs/z8encore/devtools/um0151.pdf This is the compass module pdf: http://en.zc-sensor.com/Uploadfiles/...uctFile_99.pdf Board does have a MAX232, but I was hoping to connect the module directly to the uart pins... Module is specifically TTL?!? Cheers, Rob | |
| |
| | #4 |
|
Eric, Dev board manual: http://www.zilog.com/docs/z8encore/devtools/um0151.pdf Has a MAX232, but I thought I wold be able to connect the module directly to the uart pins of the mcu. Board & mcu descriptions and circuit in manual Dev board runs on 5V supply, although regulated to 3.3V Vcc for zilog. I assumed that the compass module might do the same... what votage levels is TTL exactly? Compass module: http://en.zc-sensor.com/Uploadfiles/...uctFile_99.pdf Am I dreaming, or should this be fairly simple? Cheers, Rob Last edited by robmitch; 20th July 2009 at 12:54 PM. Reason: previous post not put up | |
| |
| | #5 | |
| Quote:
Idealised TTL levels are 0V and +5V, but in practice are about 0.4V and +4V typically. Does the Dev board have a RS232 driver ic.??
__________________ Eric " Good enough is Perfect " I will NOT answer PM's requesting technical help, please use the Forum PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/ | ||
| |
| | #6 |
|
oops, must have been editing previous post while you were replying... | |
| |
| | #7 | |
| Quote:
Got your edit and links, I'll look at the dwgs.
__________________ Eric " Good enough is Perfect " I will NOT answer PM's requesting technical help, please use the Forum PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/ | ||
| |
| | #8 |
|
Hi, You say that you are going to wire the Compass TTL onto the MCU side of the MAX232. As you have already guessed, the MCU is running at 3.3V and the Compass at 5V, so the signal voltage levels are not compatible. I would suggest the simple way way be to add a small MAX232 ic pcb and connect to the TTL i/o's of the compass. Make the connection between the dev pcb and compass via RS232. The advantage would be that the Compass could be placed some distance from the MCU dev pcb. Do you follow OK.? ![]() EDIT: Look at this pdf for ideas.
__________________ Eric " Good enough is Perfect " I will NOT answer PM's requesting technical help, please use the Forum PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/ Last edited by ericgibbs; 20th July 2009 at 01:22 PM. | |
| |
| | #9 |
|
I assumed that the compass module had a regulator to 3.3v somewhere and the tx/rx pins would be 3.3v too (when I ordered the module I asked for one that I could interface directly to the controller). As well as this, I thought I would be fine if it was a 5v signal as the zilog pins are meant to be 5v tolerant... Doesnt the MAX232 output -5v -> 12v or something for serial with computer? I have just read your pdf re: 3.3v-5v - Tip#9 - OK to direct connect CMOS 3.3v, 5v tolerant pin to 5v TTL output I was not going to use UART0 - which is connected to the MAX232, I was going to use UART1, which is on port D, and not connected yet. Still a problem with this direct connection? | |
| |
| | #10 | |
| Quote:
just looking at the Z8F datasheet, as you say you could use the 'free' uart pins on the MCU. If you can confirm that the Z8F is 5V inoput tolerant that would solve the receive. I cannot see on the Compass data where it says it can be run at 3.3V, just +5V. I would suggest that you try driving the Compass input from the Z8F, it will not harm it. On the Compass to Z8F line add a low value resistor, say 100R. Look at this for levels. http://www.interfacebus.com/voltage_threshold.html
__________________ Eric " Good enough is Perfect " I will NOT answer PM's requesting technical help, please use the Forum PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/ Last edited by ericgibbs; 20th July 2009 at 02:02 PM. | ||
| |
| | #11 |
|
Eric, So i should put a 100 Ohm resistor in series on the tx line from the compass (rx pin on the mcu). You say that shoud be ok for the receive, but the transmit...? Also, driving the compass from the Z8 - do you meant supplying power to the compass module from one of the output pins of the Z8 (3.3v)? Would I also put a current limiting resistor there too? What are your guesses with the serial protocol for that module - default 9600BAUD, 8 data bits, no parity, 1 stop bit, no flow control? Sorry about all the (silly) questions | |
| |
| | #12 | |
| Quote:
Whats the compass going to used on, boat, car etc,??? ![]() The data dosnt say any form of software or handware handshaking is available.
__________________ Eric " Good enough is Perfect " I will NOT answer PM's requesting technical help, please use the Forum PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/ Last edited by ericgibbs; 20th July 2009 at 02:25 PM. | ||
| |
| | #13 |
|
tracking yaw angle of one's head, as a headtracker One more: If the compass is transmitting 11 bytes per reading, how do i get all of those bytes - I can see how to getChar() from the rx data, pressumably everytime I get a rx interrupt, and I should keep doing this (11 times), then re-assemble the 11 bytes, converting to ascii and making sense of it from there? I suppose it would be the same as if the tranmitter sent the string: "Heading112" - you would have to read 10 char values and put it back together? Or do you get a char pointer to the rx data - char *pData = &getChar(); char cHundreds = pData[7]; char cTens = pData[8]; char cUnits = pData[9]; | |
| |
| | #14 | |
| Quote:
The ASCII compass string is: $H,123*cc followed by CRLF 0Dh 0Ah You have the option of a continous output, or output on demand by issuing a 'Order Word' P or n I would issue a 'n' command and wait for a RXD received data Interrupt. Sync the MCU string on the $ character and keep reading and storing the received compass data characters in a string until the 0Ah terminator is detected. The string is ALREADY in ASCII format so it could be used to drive an LCD etc directly. OK.? ![]() EDIT: Which programming language are you using, C ,asm etc.???
__________________ Eric " Good enough is Perfect " I will NOT answer PM's requesting technical help, please use the Forum PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/ Last edited by ericgibbs; 20th July 2009 at 02:58 PM. | ||
| |
| | #15 |
|
Thanks Eric, will give it a go and hastle you again later ![]() Regards, Rob | |
| |
|
| Tags |
| problems, receive, uart |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| PIC 16F877 UART receive | yueying_53 | Micro Controllers | 0 | 19th October 2008 08:52 AM |
| How can I Transmit/ Receive BCD | noman_dk | Electronic Projects Design/Ideas/Reviews | 3 | 23rd February 2008 05:59 PM |
| Receive data via SPI | Sam Jelfs | Micro Controllers | 2 | 11th April 2007 06:33 AM |
| receive data from other pic | janetsmith2000@yahoo.com | Micro Controllers | 1 | 24th March 2004 07:28 PM |
| receive 0 data from UART..... | wingbar | General Electronics Chat | 5 | 15th March 2004 07:11 PM |