Serial connection with MC68HC11 and Visual Basic 6

  • Thread starter Chadi Bou Hanna
  • Start date
C

Thread Starter

Chadi Bou Hanna

Hello everybody,

I'm working on a final year project and my deadline is on the 15th of May. But till now i'm facing lot of problems and i realy need your help.

The problem is that i'm sending one byte from a MC68HC11 microcontroller to the serial port Com1 of the PC, let's say that this array contains the number 50 and i'm always receiving the same number 63 whatever is the content of the sent byte.

And my second problem is that i'm not knowing how to receive an array of 30 values sent from the microcontroller, because i've never succeeded to receive more than one byte in visual basic. That means that if i read the buffer one time, i'm not able to do it another time.

I would like to thank "Refus" who helped me the last time; your trick has been good, i succeeded in transforming the display from characters to numbers by using the function asc().

Thanks very much.
 
You need to develop a "protocol" for your system. This is how the PC knows where is the data byte sent from the uC?. So, you may send the data byte, then a special character then the next data byte and so. This way the PC com port will recognize the special char and knows that the next byte is a data byte.

If you use this approach you dont need to use Mscomm function for serial com. You may use a simple Input function to read the COM1. Your program will poll the COM1 Port and will read the data bytes and special char bytes.

Hope you can solve your problem.
Mi mail is [email protected] if you have any extra questions

Good luck!!
 
Top