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 CCS Technical Support

print out my ADC values

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



Joined: 22 Sep 2012
Posts: 37

View user's profile Send private message

print out my ADC values
PostPosted: Sat Sep 22, 2012 1:35 pm     Reply with quote

Hi
I am using pickit2 with 16f690.
I am looking for a way to print out the ADC results.
LCD is not a good solution for me.
I prefer not to use an additional hardware.

Whats the best way to connect the pickit2 to a pc, and print the results in terminal ? Does picikit2 has a tool for it ?

Can I somehow print my results in real time on the pc ?

Another idea was to save results to a file and then somehow extract it out from my pic ?

I will be happy to get your opinion.
thanx
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Sep 22, 2012 4:02 pm     Reply with quote

After typing in the reply below, I noticed that Pickit 2 does have a Uart
Tool. But I have never used it. To find out more about it, just do a
Google search for this:
Quote:

pickit 2 uart tool


--------------------
Do you have the Microchip "low pin count" board ? It has a 16F690 on it.

Read this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=32455

The following parts are what I currently use for the Microchip "low pin
count" board and other boards that don't have built-in RS-232, so I can
display messages from the PIC on my PC.

RS-232 level shifter:
https://www.sparkfun.com/products/449
Pin header:
https://www.sparkfun.com/products/116
Jumper wires:
https://www.sparkfun.com/products/8430
RS-232 cable:
https://www.sparkfun.com/products/65

I break off a 4-pin section of the header and solder it into the RS-232
level shifter board. Then connect the jumper wires to the 4-pin header.
Then I connect the other ends of the jumpers to the PIC board. I
connect the RS-232 cable between my PC and the RS-232 level shifter
board.

You will also need to add a 10-pin section of the header to each side of
the PIC on the Low Pin Count board. Use the outer row of holes on each
side. Solder it.


I use the TeraTerm program to display the text output from the "low pin
count" board on my PC.
http://www.ccsinfo.com/forum/viewtopic.php?t=40920&start=1
danielz85



Joined: 22 Sep 2012
Posts: 37

View user's profile Send private message

well i have some misunderstandings.
PostPosted: Sun Sep 23, 2012 4:47 am     Reply with quote

thanx for your answer.
I have something that is not clear to me.
Lets say that I want to put the pickit2 in uart mode.

1. On the picket 2 board I can see that its pins 4-5 are goes to the pic16f690- pins 18-19, which are NOT the rs232 pins on his data sheet.
See page 41 here:
http://ww1.microchip.com/downloads/en/DeviceDoc/Low%20Pin%20Count%20User%20Guide%2051556a.pdf

I can't understand which is the tx and rx, and where is the clock ?
I need all of them to pass the rs232 from my mcu to the pickit2 no ?


2. When in ccs-c, I use the command:
Code:
#use rs232(baud=4800, xmit=PIN_A0, rcv=PIN_C3)


Can I change these pins, to be the same as my circuit board- pins 18-19 ?
because then I will not have to rewire the connections from my picket 2 to the pic16f690- I want to use the same connections ! 4/5=> 18-19 as rx/tx.

So, without additional hardware, should I just do:
Code:
#use rs232(baud=4800, xmit=PIN_A0, rcv=PIN_A1)
?
because these are the pins that goes to my mcu from picket 2 (??)

So where is the clock then ? and which is rx and tx ?

Its not clear to me.
Thanks.
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Sun Sep 23, 2012 9:30 am     Reply with quote

Obvious comment. RS232, does _not_ have a clock pin. It is _async_ serial.
Look at the connections on a PC. No 'clock' involved.

So, "No, you don't":
Quote:

I can't understand which is the tx and rx, and where is the clock ?
I need all of them to pass the rs232 from my mcu to the pickit2 no ?


Do a few searches on the difference between asynchronous serial, and synchronous serial.

Best Wishe
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Sun Sep 23, 2012 10:47 am     Reply with quote

Work on the KISS principle.

Do what PCM suggests, use the built in RS232 if you've got PIC16F690.

The data sheet tells you which pins are RX & TX.

Mike
danielz85



Joined: 22 Sep 2012
Posts: 37

View user's profile Send private message

thanks but..
PostPosted: Mon Sep 24, 2012 5:58 am     Reply with quote

Thanks but its not answering my question.

The pic16f690 data sheet shows that the pins uses the rs232 are b5/b7(rx/tx).
The pickit2 connected to my board (as i added before), and it goes to the pic16f690- pins A0/A1.

So, can I use these pins (A0/A1) to connect with the uart tool and set the rs232 to this pins with:
Code:
#use rs232(baud=4800, xmit=PIN_A0, rcv=PIN_A1)

Or should I connect the board to the other pins b5/b7 -as I mentioned before?

I am trying to understand- in the rs232 line here, can it be set to any pin that I want ?

thanks .
danielz85



Joined: 22 Sep 2012
Posts: 37

View user's profile Send private message

anyone ?
PostPosted: Tue Sep 25, 2012 3:26 am     Reply with quote

can anyone explain what am i missing here ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Tue Sep 25, 2012 3:49 am     Reply with quote

You can implement a _software_ UART on any pin (with obvious exceptions, like you can't implement an output on a pin that only supports input).

However the hardware UART is only available on the pins which the hardware is on.

For simple 'debug' type transmit, the software UART should be OK.
However if you want to _receive_, the software UART is very restricted. You have to be sitting waiting, and scanning the input line, before the data starts to arrive.
Also, with the software UART, you can't be doing anything else while sending/receiving.
(There are some slight exceptions to both of these, but only in very specific circumstances).
The software UART is also _half duplex_ only (can only send _or_ receive at any time).

With the hardware UART (especially if you use the interrupt abilities), you can have simultaneous transmission, reception, and at the same time still be running other code.

For a basic 'debug' output, yes, you can use any pins you want. For anything more complex, make the connections to the hardware.

Best Wishes
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Tue Sep 25, 2012 8:02 am     Reply with quote

I have used the PicKit2 in "uart mode" before and it works fine as long as you understand the limitations as have been mentioned. Since it is in the software UART mode, anything that changes the timing will cause scrambled data sent/received. In my case, it was not a big deal to disable ints during the printf statement (leaving the ints running resulted in periodic goofy characters in the data stream being sent - I was sending status messages every 2-1/2 seconds). For debug purposes, it works well, requires no changes to your wiring etc - you just have to be aware of the limitations - look at the bright side - it leaves the real UART free :-)

One little tidbit here on the PicKit2 that will not affect most folks, but worth mentioning. It has an issue with how it reports the header to windows (I forget the exact thing) that does not show up for most, HOWEVER, it will cause Sony Vegas (video editor) to fail to load if it is plugged in and you try to open Sony Vegas - strangely enough, it will also cause the directx tests to fail when plugged in. Unplug the PicKit2 and all is well. http://www.ccsinfo.com/forum/viewtopic.php?t=44471

mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
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