I have some code I have run for years on the 16Cxx using version 3 of the CCS compiler. It runs fine on that chip. Upon converting it to the 18C252 I ran into a promblem. When I set the high bit of the Tris reg. B to an 0 the chip seems to completly lock up. Any Serial comunacations is stopped in mid byte and the program does not proceed past that point. If I comment out the tris line every thing proceeds fine. If I leave the high bit in the tris set to a 1 everything proceeds fine. I know that B6 and B7 are used on this chip for background debuging and I have made sure the background debug bit in the fuses is disabled. I am not using any emulator or ICD and am checking the code with the "burn and pray" technic so it is very slow going to try and figure these things out...
Any help would be much appreciated
Dwight Phillips
___________________________
This message was ported from CCS's old forum
Original Post ID: 10433
Tomi Guest
Re: Tris B on the 18FXXX
Posted: Mon Jan 06, 2003 1:38 am
<font face="Courier New" size=-1>How do you set that bit?
Keep in mind that the I/O registers are at different addresses as the 16C series:
#byte port_A = 0xF80
#byte port_B = 0xF81
#byte port_C = 0xF82
#byte tris_A = 0xF92
#byte tris_B = 0xF93
#byte tris_C = 0xF94
Additionally, I suggest to use 18F252 instead of 18C252 to have "download and pray" </font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 10448
Dwight Phillips Guest
Re: Tris B on the 18FXXX
Posted: Mon Jan 06, 2003 7:37 am
I use the generic "SET_TRIS_B()" command of the CCS compiler. I have also checked the generated ASM for this command and it is setting the correct reg. for this chip.
Since I am placing this on a board that is in a current product I am limited on hardware changes. But port B is used for a LCD in 8 bit mode and I was able to change it to a 4 bit mode interface since the lower bits of port was attached on the board to D4:D7 of the LCD. That and adding "RTCC_8_BIT" to the "setup_counters()" command and the program now functions 100\% the same as it did on the 16C66. Also by making this change I now can use B6:B7 for an ICD with a few trace cuts on the board to help along my engineering.
I am still wondering why I had this problem on the chip even though I have a workaroound.
Dwight Phillips
Engineering Plus
___________________________
This message was ported from CCS's old forum
Original Post ID: 10454
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum