View previous topic :: View next topic |
Author |
Message |
Logan
Joined: 02 Aug 2011 Posts: 4
|
Send 10 bits data from ADC by USART Hardware on PIC18F4550 |
Posted: Tue Aug 02, 2011 4:24 pm |
|
|
Hello
Is it possible sending a 10 bits data from ADC module via USART Hardware on PIC18F4550 ?
Here's the thing, the Max value on adc=10 bits mode will be 1024 at 5 Volts -> 10000000000 I send it via USART to PC using putc() and I'm obviously receiving only first 8 bytes. I'm using a Visual Basic 6 MScomm module to receive data.
Do you know any method or printf() configuration that make my wish come true?, maybe sending value as hex or something like that.
Sorry for my english and Thanks for reply. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Tue Aug 02, 2011 5:48 pm |
|
|
Depending on your level of programming expertise...you have 2 options
1) You'll have to send it as 2 bytes. Both hardware UARTS(PIC and PC) are designed around 8 bit data.
2) Now if you're clever, on the PC side you could create your own serial driver to accept 12 bit data (1 start, 10 data, 1 stop).
And on the PIC side, bypass the hardware UART and just create a bit-banged serial port. Really it is NOT that difficult to do.
Option 1 is easy and 99.9% of the programmers do this.
Option 2 is what I do as I tend to not 'follow the crowd'. It also frustrates 'hackers' and socalled 'experts' as they can't figure out HOW my programs work! |
|
|
Logan
Joined: 02 Aug 2011 Posts: 4
|
|
Posted: Tue Aug 02, 2011 6:39 pm |
|
|
Thanks for your reply!
I actually have an old bit banged serial port code that I made for a PIC16F877A but in this case the problem would be on the PC side since I'm using VB6 MScomm module, anyway on both cases you propose I see that the problem will be on PC side.
Now thanks to your ideas I've decided to use the numbre (1.) I'll apreciate if you posted a litle example about how could I send an ADC 10 bits value on 2 bytes via USART.
Thanks a lot! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Logan
Joined: 02 Aug 2011 Posts: 4
|
|
Posted: Wed Aug 03, 2011 8:53 am |
|
|
Thanks so much for your Help, I`ll give a shot with HEX type and I will post the results. |
|
|
|