Firstly - I have got an LCD in the unit. Screw blinking LEDs, lets do the classics:
PROGRAM test_1;
// These are the local variables of the program block
VAR
END_VAR;
// The next code will only be executed once after the program starts
// displayClear();
displayPower(power:= ON);
displayXY(x:=1, y:=1);
displayString(message:="Hello world");
Sleep(delay:=3000);
displayClear();
an_out := 100;
So - yay - the display works. Next thing is to display something more 'active', lets do a clock:
Okay. And next - add some status readings. In this cas the power supply voltage and temperature inside the module (and a mysterious number):
BEGIN
// Code from this point until END will be executed repeatedly
clock();
displayXY(x:=1, y:=1);
displayString(message:="T "+sintToStr(v:=clock.hour)+":"+sintToStr(v:=clock.minute)+":"+sintToStr(v:=clock.second)+" ");
displayXY(x:=1, y:=2);
displayString(message:="V="+intToStr(v:=boardSupplyVoltage()/10)+" temp="+intToStr(v:=boardTemperature()/100));
END;
END_PROGRAM;
The mysterious number is read from the front-panel keypad that I'm currently fighting with. Wihout using any kind of interrupts it's quite hard to have an keyboard input AND do some stuff in the same time. I mean - you can always multithread (this controller is capale of that) but wihout that it is not that simple, and there must be a trick to do that. Currently I do not know the trick so I'm stuck with that.
The clock() is a functionblock of clockGet type, that allows me to get to the real time clock in the device.
Tomorrow I'll try to interface with the SD-card inside and iButton memory on the dedicated 1-Wire line.
Please send me pictures, step by step, how to connect and program device rtcu dx4 pro
OdpowiedzUsuńI have such a device and I cannot program it
Proszę o przesłanie zdjęć, krok po kroku, jak się połączyć i programować
OdpowiedzUsuńMam takie urządzenie i nie mogę go zaprogramować