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

How I can HEX to hyperterminal

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



Joined: 30 Jan 2008
Posts: 197

View user's profile Send private message

How I can HEX to hyperterminal
PostPosted: Tue Nov 30, 2010 4:58 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Nov 30, 2010 5:09 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Nov 30, 2010 5:14 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Nov 30, 2010 5:41 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Nov 30, 2010 5:51 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Nov 30, 2010 6:04 pm     Reply with quote

I never used Hyperterminal for known and justified reasons.
If you are reading ASCII char in your monitor may be also because it was setted for show that OR it can't
show in another format.

The best choice is to try with another communication editor. See this:
http://www.ccsinfo.com/forum/viewtopic.php?t=42307&highlight=teraterm
http://www.ccsinfo.com/forum/viewtopic.php?t=34226&highlight=teraterm
and many others...

Regards
dbotkin



Joined: 08 Sep 2003
Posts: 197
Location: Omaha NE USA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Nov 30, 2010 6:35 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Nov 30, 2010 10:24 pm     Reply with quote

Hi dbotkin,

Very Happy it is exactly that I was looking, THANK YOU!!!
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