Jump to content
OMRON Forums

Bitoperations on Gate3[0].IntCtrl


Recommended Posts


I am using the CaptCompISR to store my motor position. I run it on a PowerBrickLV at a 1kHz frequency. After the Interrupt I immediately deactivate it. According to the Manuals I cannot write to the source bits of the Gate3[0].IntCtrl-register. Therefore I worked out this bitoperation to force the Position- and Capture-Enable Bits to "0", the Position- and Capture-Flag Bits to "1" while leaving the Source-Bits unaffected.


Gate3IntCtrl = ( Gate3IntCtrl & ( Gate3IntCtrl ^ 0x00ff0000 ) ) | ( 0x000000ff ) ;


This however didn't work and I was succesful when doing these operations, one at a time which produce the same outcome


*MyFirstGate3IntCtrl = *MyFirstGate3IntCtrl & 0xff00ff00 ;

*MyFirstGate3IntCtrl = *MyFirstGate3IntCtrl | 0x000000ff ;


Then I use a phase routine to calculate the offset a my desired position and to inject it into to the Motor[1].CompPos register. At the end I want to activate the ISR again.

There too I could use this code :


Gate3IntCtrl = ( Gate3IntCtrl & ( Gate3IntCtrl ^ 0x00ff0000 ) ) | ( 0x00010000 ) ;


To enable Position-Capture on Gate3[0] However it didn't work that way and I found that simply writing to it works:


Gate3[0].IntCtrl = 0x00010000 ;


However I expected there to be problems if I that would result in writing a "0" to the source bits. Does anyone have any further insight into this?

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

This topic is now closed to further replies.

  • Create New...