Author Topic: microcontroller connection  (Read 10286 times)

scottsaunders

  • Guest
microcontroller connection
« 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.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

scottsaunders

  • Guest
Re: microcontroller connection
« Reply #1 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
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: microcontroller connection
« Reply #2 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.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

scottsaunders

  • Guest
Re: microcontroller connection
« Reply #3 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.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: microcontroller connection
« Reply #4 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.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS