Hello, I am trying to initialise the CAN interface on a C164 - I need to set the XPEN bit, and clear the CAN1DIS bit in the SYSCON register. However, I am using C, and thus C_STARTUP_CODE is loaded into RAM, which contains the EINIT instruction (which locks down access to SYSCON). Therefore, EINIT has already been executed by the time my main() starts, and so I cannot access this register. I'm having trouble interpreting the machine code on the reset vectors too, so I can't just put a JumpToHere, JumpToThere, sequence in. Any help would be much appreciated.
Hi Chris, What keeps you from modifying START167.A66 ? And I'm not sure why you would want to interpret machine code on the reset vectors. - mike
Hi there Mike, thanks for your reply. Nothing, now that I know which file to get! I've been thrown onto this project with the scantest (read: nothing) of documentation and it's a nightmare. :) It seems though, that the label given to the SYSCON bit I am interested in has different names in my user-manual (XPEN) and in Start167.A66 (_XRAMEN). Is this an issue? It also seems from some preliminary testing, that setting this bit shuts down my use of RS-232 in testing (I'm using printf()'s to write register values to screen).. does this seem likely? Once again, thanks a lot for your help.
Sorry, cancel that last comment re: RS232.
During build-time, it seems like the only file the build-process needs is one called C167S.LIB, and putting deliberate errors into the START*.A66 files does nothing. When I open C167S.LIB, I can see the text "C_STARTUP_CODE", so I assume I have to change the source of this file, and then compile it (?) again. The EINIT command it definitely contained within this C_STARTUP stuff, as I can see from the .M66 file. Perhaps the settings for SYSCON are too?
View all questions in Keil forum