Internet PLC Forum

General => Technical support => Topic started by: scottsaunders on December 11, 2002, 07:28:18 AM

Title: microcontroller connection
Post by: scottsaunders on December 11, 2002, 07:28:18 AM
I have a Motorolla M68HC12 microcontroller, which I want to connect to your PLC.  The M68HC12 interface has an RS232 output connector on-board. Can I use the RS232 connector on the PLC to transfer the required data from the M68HC12 to the PLC using this connector, then use the transferred data  in my programme?

I have looked at your manuals and the posts in this forum but I can't find any relevant information.

I realise that I will have to download the programme to the PLC before connecting the M68HC12.
Title: Re: microcontroller connection
Post by: scottsaunders on December 11, 2002, 07:32:23 AM
sorry forgot to mention, I cant connect the PLC to the PC using an RS485 connection because i don't have the hardware on my PC and don't have the budget to by an RS232-RS485 adaptor. This may be irrelevant anyway
Title: Re: microcontroller connection
Post by: support on December 11, 2002, 07:41:52 AM
It is very easy for the M-series PLC to send data out of the serial port. You can use either the PRINT #1 or OUTCOMM 1, x  (to send binary data).

The tough part of your project is writing the RS232 handling routine in the 68HC12 which you do need to have the hardware knowledge, a C compiler or assembler and all the necessary hardware/software for programming it.
Title: Re: microcontroller connection
Post by: scottsaunders on December 11, 2002, 08:14:06 AM
I dont want to send information to the microprocessor I want to recieve info from the microprocessor and use that data in my PLC programme.
Title: Re: microcontroller connection
Post by: support on December 11, 2002, 08:44:18 AM
You can use the

A$ = INPUT$(1)

command to receive ASCII string inputs that are terminated with CR (ASCII 13, carriage return). This function returns an empty string if there isn't a completed string in the buffer. You need to execute this command periodically until you don't see a empty string.

To receive binary data inputs, use

   DM = INCOMM(1)

use a FOR NEXT loop and read until your receive a -1 which means no more characters in the buffer.