Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools Display Modes
Old 12th January 2009, 02:08 PM   #1 (permalink)
Default PIC and Hyperterminal Communication

Hello All,

I would like some advice on how I can get my Hyperterminal program to display a worded message from a bit stream sent by my PIC16F88.

My current project is set up as follows:-

My PIC16F88 recieves three '1' or '0' inputs from a set of switches (these switches are simulating another PICs outputs).

In my code (help also needed), I assign worded messages to each combination of 1s and 0s. E.g. Recieve 101, Send message "FAIL".

This message, in binary, is then sent through one pin of the PIC, through a MAX232 converter and into my PC via a serial port.

I do not need to send data to the PIC, just need to display a message related to the input from the switches.

So, my main question is this......

Can this be done the way I have explained it? And if I assign all letters in my message with the correct ASCII code and choose the ASCII selection in Hyperterminal, will my message, e.g. "FAIL", appear on my monitor?

Any help is greatly appreciated, keep up the good work!
00morrisd is offline  
Old 12th January 2009, 03:14 PM   #2 (permalink)
Default

Quote:
Originally Posted by 00morrisd View Post
Can this be done the way I have explained it? And if I assign all letters in my message with the correct ASCII code and choose the ASCII selection in Hyperterminal, will my message, e.g. "FAIL", appear on my monitor?
Yes it can be done. It's pretty easy too. Look at Chapter 11.0 in the datasheet. You'll need to study right from the start of the chapter, but the steps you'll need to follow to set up and transmit are on Page 103.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is offline  
Old 12th January 2009, 03:48 PM   #3 (permalink)
Default

Also look at Nigel Goodwin's RS232 tutorial for help.
nickelflippr is offline  
Old 12th January 2009, 04:09 PM   #4 (permalink)
Default

Thanks Guys,

Which language / programs do you think I need to use to write the code. I am settled on using Hyperterminal and PICSTART to download the program but apart from that I can use pretty much anything else.

Please bare in mind though that I am completely useless at all Programming and I have been asked to use C++ if possible.

Any examples of code would be great so I can see what a finished product would look like!
00morrisd is offline  
Old 12th January 2009, 04:30 PM   #5 (permalink)
Default

Quote:
Originally Posted by 00morrisd View Post
Which language / programs do you think I need to use to write the code. I am settled on using Hyperterminal and PICSTART to download the program but apart from that I can use pretty much anything else.

Please bare in mind though that I am completely useless at all Programming and I have been asked to use C++ if possible.

Any examples of code would be great so I can see what a finished product would look like!
Use any language you like. Assembly language is fine, or the higher level language of your choice. You won't likely be using C++, as it isn't really suited to microcontroller use. But C is no problem. I prefer BoostC, but there are several others. They're all pretty good.

Poke around on my site and you'll find some RS232 code you could adapt (or, as suggested, look at Nigel's tutorials). I don't know if it's for 16F88, but the PIC UARTs are so similar that it would probably work on almost any PIC (with minor changes).
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is offline  
Old 12th January 2009, 04:48 PM   #6 (permalink)
Default

Not to start a holy war, but i don't understand why anyone would use a non ANSI C compiler (such as BoostC). If you're starting a commercial product, your code may be around for 5, 10 or even 15 years. Is the BoostC compiler going to be around that long? You're pretty much binding your project's fate to that of the proprietary compiler. To make a long rant short - i recommend using pure ANSI C (even refraining from using the 0b0010010 binary format specifier). I love C++ (it's what i use when i write code for the 32 bit processors) but would never think of using it for an 8 bit. I doubt there is a compiler for it as well. Remember that most you can do in C++ (besides templates) can be done in C - write object oriented code! It's a theory, not a syntax.

As for hyperterminal - this is the lowest you can get in terms of a serial program. It might seem to suite your needs (it does) but it's just awful. You're better off using something free like putty or shelling out for CRT (which has been deprecated for SecureCRT) - hands down the best serial terminal i know.

Edit: I doubted it, but BoostC++ exists for PIC16. Nice.

Last edited by Pavius; 12th January 2009 at 04:53 PM.
Pavius is offline  
Old 12th January 2009, 05:01 PM   #7 (permalink)
Default

Quote:
Originally Posted by Pavius View Post
Not to start a holy war, but i don't understand why anyone would use a non ANSI C compiler (such as BoostC). If you're starting a commercial product, your code may be around for 5, 10 or even 15 years. Is the BoostC compiler going to be around that long? You're pretty much binding your project's fate to that of the proprietary compiler. To make a long rant short - i recommend using pure ANSI C (even refraining from using the 0b0010010 binary format specifier).
BoostC is ANSI compatible.

EDIT: I'd be willing to bet that the OP's project is a school assignment. Not likely the code will be around in 5 years.

Quote:
As for hyperterminal - this is the lowest you can get in terms of a serial program. It might seem to suite your needs (it does) but it's just awful.
Ya it kinda sucks. But it's always there (in XP) and works ok usually. I use Tera Term Pro.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 12th January 2009 at 05:12 PM.
futz is offline  
Old 12th January 2009, 05:09 PM   #8 (permalink)
Default

Quote:
Originally Posted by 00morrisd View Post
Please bare in mind though that I am completely useless at all Programming and I have been asked to use C++ if possible.
Uggh! Just say no to Object Oriented Programming for microcontrollers.
nickelflippr is offline  
Old 12th January 2009, 05:41 PM   #9 (permalink)
Default

Quote:
Originally Posted by nickelflippr View Post
Uggh! Just say no to Object Oriented Programming for microcontrollers.


Bad, non-object oriented, C code:

Code:
/* get temperature */
signed char temp_read()
{
   /* do read */
   i2c_read(SOME_DEVICE_ADDRESS_DEFINED_IN_HEADER, ...);

   /* error handling and return result ... */

}
Good, object oriented, C code:

Code:
/* get temperature from sensor previously initialized with temp_init() */
signed char temp_read(handle temp_sensor)
{
   /* cast handle (which is a typedef'ed void *) to info structure */
   temp_sensor_info = (temp_sensor_info_t *)temp_sensor;

   /* do read */
   i2c_read(temp_sensor_info->i2c_address, ...);

   /* error handling and return result ... */
}
So simple, very little overhead yet so much more flexible.

Last edited by Pavius; 12th January 2009 at 05:42 PM.
Pavius is offline  
Old 12th January 2009, 05:47 PM   #10 (permalink)
Default

Quote:
Originally Posted by futz View Post
I use Tera Term Pro.
I used tera term about 6 years ago and it felt very outdated back then (pre-windows 95 icons ). I just checked and saw that it hasn't been updated since. I highly recommend CRT/SecureCRT - it just does what a terminal should do (sounds trivial but as you probably know - very rare).
Pavius is offline  
Old 12th January 2009, 05:50 PM   #11 (permalink)
Default

Quote:
Originally Posted by Pavius View Post
I used tera term about 6 years ago and it felt very outdated back then (pre-windows 95 icons ). I just checked and saw that it hasn't been updated since. I highly recommend CRT/SecureCRT - it just does what a terminal should do (sounds trivial but as you probably know - very rare).
Ya, it is very old fashioned. But it does exactly what I need and I like it.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is offline  
Old 28th January 2009, 02:45 PM   #12 (permalink)
Default Not Hyper Terminal but...

Hyper terminal is for programmers in hell.

Some alternatives:

BoostC has a built in terminal window ( took me 2 months to notice it )
Some bootloaders have built in terminals ( google around, i forget witch
"screamer" or something similar is one that may be right.
Free Software for rs485 rs422 rs232 serial Communications has a nice free term. emul.

and there is a list at:

PC-Microcontroller Communications - Open Circuits
russ_hensel is offline  
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Title Starter Forum Replies Latest
hyperterminal communication w/ 8051 spyghost Micro Controllers 8 22nd May 2008 10:54 AM
Hyperterminal- Enter Key <CR> <LF> dknguyen Micro Controllers 17 5th April 2008 01:38 PM
New to serial communication, Hyperterminal? AceOfHearts Micro Controllers 26 8th December 2007 08:19 AM
rs232 communication with hyperterminal dak246 General Electronics Chat 10 6th June 2005 09:50 AM
LCD display and Hyperterminal communication with 16F877 peter83 Micro Controllers 2 16th May 2004 06:28 AM



All times are GMT. The time now is 12:26 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker