|
|
View previous topic :: View next topic |
Author |
Message |
carlosluis
Joined: 12 Jul 2005 Posts: 2
|
PIC18F8722 PIN_E4 PROBLEM |
Posted: Tue Jul 12, 2005 10:14 am |
|
|
I'm emulating the PIC18F8722. I need to control some digital signal in pin E4 of the MCU. It happens that it does not obey. The tris is configured 0x00, the CCP3CON module is disabled, and all the pins are digital i/o in the ADCON1 register. Also the MCU is working in microcontroller mode.
The Device adapter is not put in the PCB it's running just the emulator without being connected to the circuit, so that eliminates the possibility of my circuit pullind down the line.
I'm running a simple code, then halting the execution and manually changing the value in the SFRs window (all the other pins obey but PIN E4). Here's the code (CCS). I've checked the produced ASM code and it's accurate.
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL|RTCC_OFF);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
System:
XP SP2, MPLAB 7.20
I'd appreciate some light in the issue. _________________ Carlos Luis |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jul 12, 2005 12:40 pm |
|
|
To solve this problem, look in the 18F8722 data sheet.
In the section 11.5 on I/O Ports, for Port E, it says:
Quote: | In 80-pin devices, PORTE is multiplexed with the
system bus as part of the external memory interface. |
and
Quote: | I/O port and other functions are only available when the
interface is disabled by setting the EBDIS bit (MEMCON<7>). |
Then look at section 7.1 on the MEMCON register. In the bit diagram
for the register, it shows the power-up default state of each bit.
For the EBDIS bit, the power-up state = 0.
Then look below to see the meaning of each state:
Quote: | 1 = External bus enabled when microcontroller accesses external
memory; otherwise, all external bus drivers are mapped as I/O ports
0 = External bus always enabled, I/O ports are disabled |
So you need to set the EBDIS bit in the MEMCON register = 1.
This is done by defining the address of the register with a #byte
statement, and then define the bit with a #bit statement.
To find the address of the MEMCON register, you look in section 5.3.4,
which is the Special Function Register section of the Memory Organization
section in the data sheet. There you can see the MEMCON address is
0xF9C. You already know that EBDIS is bit 7 by reading section 7.1
of the data sheet. So the #byte and #bit statements will be:
Code: | #byte MEMCON = 0xF9C
#bit EBDIS_BIT = MEMCON.7 |
Then set the bit = 1 by using a line of code at the start of your program:
Code: | main()
{
EBDIS_BIT = 1; // Disable external memory interface
} |
|
|
|
carlosluis
Joined: 12 Jul 2005 Posts: 2
|
|
Posted: Tue Jul 12, 2005 8:22 pm |
|
|
Thanks PCM, I noticed that (and I didn't include it in my post, sorry) I'm emulating the MCU in microcontroller mode, so if you check in MPLAB in the SFRs window, the MEMCON byte is disabled.
Anyway I tried the code you sent and still doesn't work. It seems until now that could be a bug associated with the ICE 2000 module the PCM18XS0, I contacted the web support of microchip 1 day ago, they haven't answered yet :|, if you have any other suggestions I'll appreciate them. Thanks again for your answer _________________ Carlos Luis |
|
|
|
|
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
|
Powered by phpBB © 2001, 2005 phpBB Group
|