CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Send 10 bits data from ADC by USART Hardware on PIC18F4550

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Logan



Joined: 02 Aug 2011
Posts: 4

View user's profile Send private message Yahoo Messenger

Send 10 bits data from ADC by USART Hardware on PIC18F4550
PostPosted: Tue Aug 02, 2011 4:24 pm     Reply with quote

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: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Aug 02, 2011 5:48 pm     Reply with quote

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

View user's profile Send private message Yahoo Messenger

PostPosted: Tue Aug 02, 2011 6:39 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Aug 02, 2011 6:51 pm     Reply with quote

See these suggestions by Ttelmah:
http://www.ccsinfo.com/forum/viewtopic.php?t=44131&start=2
Logan



Joined: 02 Aug 2011
Posts: 4

View user's profile Send private message Yahoo Messenger

PostPosted: Wed Aug 03, 2011 8:53 am     Reply with quote

PCM programmer wrote:
See these suggestions by Ttelmah:
http://www.ccsinfo.com/forum/viewtopic.php?t=44131&start=2


Thanks so much for your Help, I`ll give a shot with HEX type and I will post the results.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group