{"id":13,"date":"2007-08-01T19:22:09","date_gmt":"2007-08-02T02:22:09","guid":{"rendered":"http:\/\/www.reisun.com\/2007\/08\/01\/psoc-timer16-datasheet-error\/"},"modified":"2007-08-01T19:22:09","modified_gmt":"2007-08-02T02:22:09","slug":"psoc-timer16-datasheet-error","status":"publish","type":"post","link":"https:\/\/www.reisun.com\/?p=13","title":{"rendered":"PSOC Timer16 Datasheet Error"},"content":{"rendered":"<p>I teach another course, an embedded programming and robotics course. For the embedded programming part I use the <a href=\"http:\/\/www.cypress.com\">Cypress Semiconductor<\/a> PSOC (Programmable System On a Chip), which is a really versatile microcontroller\/SOC.<\/p>\n<p>\u00c2\u00a0I 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 <a href=\"http:\/\/www.psocdeveloper.com\/\">www.psocdeveloper.com<\/a>,\u00c2\u00a0a website that is devoted to the\u00c2\u00a0PSOC, but didn&#8217;t receive an answer. Luckily I was able to figure it out myself!<\/p>\n<pre>\nI am examining the output of the Device configurator\nfor a Timer16 module, for both InvertCapture set to\nNormal and Invert.Now the Datasheet says that the\n\"Data Invert\" Bit exists in Bit 7 of the Bank 1 MSB\nFunction Register.Looking at the generated\npsocconfigtbl.asm file, it appears that the bit that\nis being set\/cleared by the Designer is the LSB\nFunction RegisterInvertCapture Normal:\n\n; Instance name T, Block Name TIMER16_LSB(DCB22)\ndb 48h, 00h ;T_FUNC_LSB_REG(DCB22FN)\n; Instance name T, Block Name TIMER16_MSB(DCB23)\ndb 4ch, 20h ;T_FUNC_MSB_REG(DCB23FN)\nInvertCapture Inverted:\n; Instance name T, Block Name TIMER16_LSB(DCB22)\ndb 48h, 80h ;T_FUNC_LSB_REG(DCB22FN)\n; Instance name T, Block Name TIMER16_MSB(DCB23)\ndb 4ch, 20h ;T_FUNC_MSB_REG(DCB23FN)\n\nDoes anyone know which is correct, the IDE or the datasheet?\nI am using 4.3 and have checked the 4.4 release notes but\ndon't see this mentioned at all.<\/pre>\n<p>\u00c2\u00a0I posted the solution as well:<\/p>\n<pre>\nThe data sheet is indeed incorrect and the IDE does\ngenerate the proper code (LSB). what was preventing\nme from quickly deducing this was a bug in my own code,\nwhich failed to set the bank to 1 before changing the\nregister.It now works and I can dynamically flip between\nnormal and inverted capture.<\/pre>\n<p>The code I wrote (and fixed) is:<br \/>\n<code><\/code><code>Ping_Capture_Normal:<br \/>\n\u00c2\u00a0M8C_SetBank1<br \/>\n\u00c2\u00a0mov reg[PingT_FUNC_LSB_REG],Ping_CAPTURE_NORMAL<br \/>\n\u00c2\u00a0M8C_SetBank0<br \/>\n\u00c2\u00a0ret<br \/>\nPing_Capture_Inverted:<br \/>\n\u00c2\u00a0M8C_SetBank1<br \/>\n\u00c2\u00a0mov reg[PingT_FUNC_LSB_REG],Ping_CAPTURE_INVERTED<br \/>\n\u00c2\u00a0M8C_SetBank0<br \/>\n\u00c2\u00a0ret<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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. \u00c2\u00a0I have been trying to interface an ultrasonic transducer to the PSOC using the Timer user module, and came across an error in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,15],"tags":[],"class_list":["post-13","post","type-post","status-publish","format-standard","hentry","category-embedded-systems","category-robotics"],"_links":{"self":[{"href":"https:\/\/www.reisun.com\/index.php?rest_route=\/wp\/v2\/posts\/13","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.reisun.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.reisun.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.reisun.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.reisun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13"}],"version-history":[{"count":0,"href":"https:\/\/www.reisun.com\/index.php?rest_route=\/wp\/v2\/posts\/13\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.reisun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reisun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reisun.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}