View Single Post
Old 02-13-2012, 08:46 PM   #70 (permalink)
thingstodo
Master EcoModder
 
Join Date: Sep 2010
Location: Saskatoon, canada
Posts: 1,488

Ford Prefect - '18 Ford F150 XLT XTR

Tess - '22 Tesla Y LR
Thanks: 746
Thanked 565 Times in 447 Posts
More about the PLC - what it is and what it does

How do you access the variables that represent switches ON and OFF?

The digital inputs and outputs are memory mapped. You read the correct address and you see the state of the input. Write to the correct address and the output changes at the end of the PLC scan.



What about the voltages, currents, temperatures, etc?

The analog inputs and outputs as well as the encoder information is transferred in blocks that take a bit of programming. The blocks give you a signal, called a DONE bit, when the information has been updated. At that point, you copy the data to another memory address and you use the second memory address for all of your calculations.

The 'landing zone' for the analogs and encoders is N9. This is a 'file', which is an array of variables of the same type. Each is accessed by using the file name, N9, along with it's index, like N9:0. N9 is set up with a length of 400 for now. The analog input uses N9:0 through N9:20, for example. The N in the filename defines the type of the variables in the array, 16 bit integers. These are signed integers.

The second memory address for analog inputs is N11, 1 looks like I or input, so I use N11 for analog inputs as well as the encoder and N10, where the 0 looks like O for outputs, for analog outputs. These files are much smaller. N11 is a length of 40, N10 is a length of 16



Why not use a Curtis controller? Why go through all of this effort?

One of my big goals in this is to UNDERSTAND what it is that is going on, to be able to fix it, and to upgrade pretty much anything if I want to. The motor controllers that are sold, even the DIY versions, have some parts that are pretty hard for me to understand. They also have limitations on what types of inputs can be used, and what types of outputs can be driven. Right now, I'm all about flexibility. Perhaps I'll discover that the available controllers cover everything that I need ... perhaps not. But I will discover ...

This PLC5 can take many types of input and generate many types of output.

The PLC5's largest drawback, in my opinion, is communications, or rather ... it's LACK of communicaitons. It does NOT support 1-wire, or SPI, or pretty much any communication format but it's own DF1 protocol ... and plain ASCII output (like to a serial printer). There are a few third-party cards to help with that, but they always felt like stop-gap solutions to me.

So I'm going to try my own 'stop-gap solution'. An arduino that will log data, transfer it to a PC or a dedicated display.
  Reply With Quote