View previous topic :: View next topic |
Author |
Message |
pilar
Joined: 30 Jan 2008 Posts: 197
|
How I can HEX to hyperterminal |
Posted: Tue Nov 30, 2010 4:58 pm |
|
|
Hi, I need to send the Hyperterminal a block of hex codes, how I can do this?
I am use this code, but its does not work, what is my error?
Code: | for (k = 0; k<538; k++)
printf("%x",read_ext_eeprom(0,k,)); |
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Tue Nov 30, 2010 5:09 pm |
|
|
Please gives us the entire program along with software version.
There are several ways it could 'not work'.
Power supply problems...
board layout...
The eeprom data is corrupt, the eeprom address is wrong(hint what type is variable k).
The serial configuration for the PIC is in error..
either software(baud,bits,etc) or hardware(MAX232 chip mising ?)
The PC and Hyperterminal are not configured correctly
As you can see that's only a few of the reasons it 'doesn't work'.
The more information, specifically -what- doesn't work, will allow others to repsond to your question. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Nov 30, 2010 5:14 pm |
|
|
Quote: | for (k = 0; k<538; k++)
printf("%x",read_ext_eeprom(0,k,)); |
'k' must be declared as an 'int16' variable, because 538 is greater than
the maximum 'int8' value of 255. Also, printf must use "%lx" to display an int16.
All of this is in the CCS manual.
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
Look in the section on "Basic and Special Types", and in the section on printf.
--------------------
And to others, please, we don't need 4-5 posts saying how bad
Hyperterminal is. One of those per month is enough, lol. |
|
|
pilar
Joined: 30 Jan 2008 Posts: 197
|
|
Posted: Tue Nov 30, 2010 5:41 pm |
|
|
Hi PCM programmer,
I am sorry, maybe I explained wrong!!!, I can see in the hyperterminal the block of codes sent but was converted to an ASCII format, but I need that the hyperterminal receive these codes as the PIC have been sent, for example if the PIC send the 0x32 in the hyperterminal should show the character "2", if the PIC send the code 0x49 in hyperterminal should show the "I" and so on, what I have to do to accomplish this?
example
Code: | PIC Hypert.
0x32 2
0X43 C
0x49 I |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Nov 30, 2010 5:51 pm |
|
|
Download the manual:
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
Look in the section on printf. You want to send a character.
What format string should you use ? It's listed in the manual.
Keep a copy of the CCS manual on your Windows desktop. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
|
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
|
Posted: Tue Nov 30, 2010 6:35 pm |
|
|
Hyperterminal is indeed a POS, but that's not your (biggest) problem. As PCM Programmer suggested, download and read the manual for help with the printf() function. In your case, a simple putc() would work as well:
Code: |
long int k;
for (k = 0; k<538; k++) {
putc(read_ext_eeprom(k));
}
|
Last edited by dbotkin on Tue Nov 30, 2010 11:00 pm; edited 1 time in total |
|
|
pilar
Joined: 30 Jan 2008 Posts: 197
|
|
Posted: Tue Nov 30, 2010 10:24 pm |
|
|
Hi dbotkin,
it is exactly that I was looking, THANK YOU!!! |
|
|
|