ChantalPlusPlus Posted February 25, 2015 Share Posted February 25, 2015 Hi Everyone Can someone please help me? This might be a silly question but I am very new to DaqFactory and I've only done some very basic things. Register in my header file "Modbus.h": //Code #define h_STATUS0 0 #define S_ReadyToStart 0x0001 #define S_PreStart 0x0002 #define S_Run 0x0004 #define S_Cooling 0x0080 #define S_Short 0x0010 #define S_EFL 0x0020 #define S_Stop 0x0040 #define S_OverVoltage 0x0080 #define S_UnderVoltage 0x0100 #define S_VoltageUnb 0x0200 #define S_OverCurrent 0x0400 #define S_UnderCurrent 0x0800 #define S_CurrentUnb 0x1000 #define S_EarthFault 0x2000 #define S_PhaseLoss 0x4000 #define S_PhaseRotation 0x8000 //End of Code So I have a holding register (h_STATUS0), that contains bits, and each bit represents a "status", which on my output is an LED. If I set up a channel in DaqFactory "wh_STATUS0, channel=0", and I want to use the channel but set only "S_ReadyToStart" (0x0001) to "1", how do I do this? I hope this question makes sense and that someone can help me:) Thanks in advance! Link to comment Share on other sites More sharing options...
AzeoTech Posted February 25, 2015 Share Posted February 25, 2015 Set the channel with Timing so you are reading the current status value. Then, if you wanted to, say, enable S_PhaseLoss you'd do: wh_status0 = setBit(wh_status0[0], 14) or to turn off CurrentUnb: wh_status0 = clearBit(wh_status0[0], 12) Note that the 14 and 12 are bit numbers, numbered from 0. So in your list, readyToStart is bit 0, prestart is bit 1, etc from 0 to 15 right down the list (you have a type of cooling, it should be 0x0008) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.