PSOC Timer16 Datasheet Error
I teach another course, an embedded programming and robotics course. For the embedded programming part I use the Cypress Semiconductor PSOC (Programmable System On a Chip), which is a really versatile microcontroller/SOC.
 I have been trying to interface an ultrasonic transducer to the PSOC using the Timer user module, and came across an error in the datasheet. I posted the following on www.psocdeveloper.com, a website that is devoted to the PSOC, but didn’t receive an answer. Luckily I was able to figure it out myself!
I am examining the output of the Device configurator for a Timer16 module, for both InvertCapture set to Normal and Invert.Now the Datasheet says that the "Data Invert" Bit exists in Bit 7 of the Bank 1 MSB Function Register.Looking at the generated psocconfigtbl.asm file, it appears that the bit that is being set/cleared by the Designer is the LSB Function RegisterInvertCapture Normal: ; Instance name T, Block Name TIMER16_LSB(DCB22) db 48h, 00h ;T_FUNC_LSB_REG(DCB22FN) ; Instance name T, Block Name TIMER16_MSB(DCB23) db 4ch, 20h ;T_FUNC_MSB_REG(DCB23FN) InvertCapture Inverted: ; Instance name T, Block Name TIMER16_LSB(DCB22) db 48h, 80h ;T_FUNC_LSB_REG(DCB22FN) ; Instance name T, Block Name TIMER16_MSB(DCB23) db 4ch, 20h ;T_FUNC_MSB_REG(DCB23FN) Does anyone know which is correct, the IDE or the datasheet? I am using 4.3 and have checked the 4.4 release notes but don't see this mentioned at all.
 I posted the solution as well:
The data sheet is indeed incorrect and the IDE does generate the proper code (LSB). what was preventing me from quickly deducing this was a bug in my own code, which failed to set the bank to 1 before changing the register.It now works and I can dynamically flip between normal and inverted capture.
The code I wrote (and fixed) is:
Ping_Capture_Normal:
 M8C_SetBank1
 mov reg[PingT_FUNC_LSB_REG],Ping_CAPTURE_NORMAL
 M8C_SetBank0
 ret
Ping_Capture_Inverted:
 M8C_SetBank1
 mov reg[PingT_FUNC_LSB_REG],Ping_CAPTURE_INVERTED
 M8C_SetBank0
 ret