Not sure if this is the best place to ask this, but can't find a whole lot of places on the web specific to my problem. I need to create a program using VC++ that uses the DTR/RTS pins directly to turn an X10 device off/on. I have the com port setup properly and can toggle the DTR/RTS pins as needed, but I am not sure if I am toggling them correctly. I am using a CM17a firecracker device. The following manaul is what I am using to go by:
X10 - Firecracker manual
I am kinda confused on the wait states. Do I need to set the DTR/RTS pins high(ie. 'Standby' mode) for the 'wait' states X10 lists in the timing diagram or are the wait states considered as a 'wait' done by a timer/Sleep() function?
Here is the array I created for the header data:
DWORD RTSH[]={ CLRRTS, SETRTS, SETRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS};
DWORD DTRH[]={ CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR};
16 bits plus actual wait states (SETRTS/SETDTR) are done by setting the bits high. Is this the proper way to do the 'wait'?
Here is what I did for the header data minus the 'waits' and didn't help any(not sure which way is correct??):
DWORD RTSH[]={ CLRRTS, SETRTS, SETRTS, CLRRTS, SETRTS, CLRRTS, SETRTS, CLRRTS, SETRTS, SETRTS, CLRRTS, SETRTS, CLRRTS, SETRTS, CLRRTS, SETRTS, CLRRTS};
DWORD DTRH[]={ CLRDTR, CLRDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR};
The same method is continued for the Data segment and footer. I can not make either method work. I can assure you the RTS/DTR bits are being set in my program as indicated above in the arrays. I have hooked up a RS-232 Loopback tester that has LEDs for each pin. Stepping through the code shows the pin settings are working fine.
What am I missing with my pin setting/clearing?
Sorry for the long winded post and hope it wasn't too confusing. Hard to describe the problem without the examples and description of what I am doing. Just need an 'A1' X10 device to turn off and on with a CM17a using the DTR/RTS pins directly.
Thanks for the time
--
DT
X10 - Firecracker manual
I am kinda confused on the wait states. Do I need to set the DTR/RTS pins high(ie. 'Standby' mode) for the 'wait' states X10 lists in the timing diagram or are the wait states considered as a 'wait' done by a timer/Sleep() function?
Here is the array I created for the header data:
DWORD RTSH[]={ CLRRTS, SETRTS, SETRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS, SETRTS, SETRTS, SETRTS, CLRRTS};
DWORD DTRH[]={ CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR, SETDTR, CLRDTR, SETDTR, SETDTR};
16 bits plus actual wait states (SETRTS/SETDTR) are done by setting the bits high. Is this the proper way to do the 'wait'?
Here is what I did for the header data minus the 'waits' and didn't help any(not sure which way is correct??):
DWORD RTSH[]={ CLRRTS, SETRTS, SETRTS, CLRRTS, SETRTS, CLRRTS, SETRTS, CLRRTS, SETRTS, SETRTS, CLRRTS, SETRTS, CLRRTS, SETRTS, CLRRTS, SETRTS, CLRRTS};
DWORD DTRH[]={ CLRDTR, CLRDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR, CLRDTR, SETDTR};
The same method is continued for the Data segment and footer. I can not make either method work. I can assure you the RTS/DTR bits are being set in my program as indicated above in the arrays. I have hooked up a RS-232 Loopback tester that has LEDs for each pin. Stepping through the code shows the pin settings are working fine.
What am I missing with my pin setting/clearing?
Sorry for the long winded post and hope it wasn't too confusing. Hard to describe the problem without the examples and description of what I am doing. Just need an 'A1' X10 device to turn off and on with a CM17a using the DTR/RTS pins directly.
Thanks for the time
--
DT
Comment