<< to CrossControl homepage

Support & Service Center

CCAux Interface Example with CoDeSys

Printer-friendly versionPrinter-friendly versionPDF versionPDF version

To access different interfaces of your arm device you should use our CCAux API. Below is an basic example of the most common uses.


Extracted from the CCAuxTestARMv7:
// Below example shows the simple interface access of the Buzzer
PROGRAM Buzzer
VAR
	result: eErr;
	volume: UINT := 45;
	currentVolume: UINT;
	setVolume: BOOL := FALSE;
 
	frequency: UINT := 800;
	currentFrequency: UINT;
	setFrequency: BOOL := FALSE;
 
	buzzOn: BOOL := FALSE;
	buzzerOn: BOOL := FALSE;
	buzzerOff: BOOL := FALSE;
	buzzerOnState: BOOL;
	timeperiod: INT := 500;
END_VAR

IF setVolume THEN
	result := Buzzer_SetVolume(volume:=volume);
	result := Buzzer_GetVolume(volume=>currentVolume);
	setVolume := FALSE;
END_IF
 
IF setFrequency THEN
	result := Buzzer_SetFrequency(frequency:=frequency);
	result := Buzzer_GetFrequency(frequency=>currentFrequency);
	setFrequency := FALSE;
END_IF
 
IF buzzOn THEN
	result:=Buzzer_Buzz(timePeriod:=timeperiod, blocking:=FALSE);
	buzzOn := FALSE;
END_IF
 
result := Buzzer_GetTrigger(trigger=>buzzerOnState);
 
IF buzzerOn THEN
	result := Buzzer_SetTrigger(trigger:=TRUE);
END_IF
 
IF buzzerOff THEN
	result := Buzzer_SetTrigger(trigger:=FALSE);
	buzzerOn:=FALSE;
	buzzerOff:=FALSE;	
END_IF
Environment and Versions: 

CoDeSys 3.5.4.2

CCAux 2.7.3

LinX-Base 1.1

 

whatever