Jump to content
ColinH

C Compiler --> Ide --> Debug Error (i Think)

Recommended Posts

Using IDE 7.01 on Windows 7, using selected target PIC16F723

 

This is the simple C source

 

----

 

#include <system.h>

#pragma CLOCK_FREQ 16000000
#ifdef _PIC16
 #pragma DATA _CONFIG1, _DEBUG_ON & _PLL_EN & _BORV_2_5 & _BOR_OFF & _CP_OFF & _MCLR_EN & _PWRTE_ON & _WDT_OFF & _INTOSCIO
 #pragma DATA _CONFIG2, _VCAP_DIS 
#endif

void main()
{
ansela=0; // Set digital mode for all Port A lines
adcon0=0; // Disable all AD Conversion
adcon1=0; // 
cpscon0=0;// Disable capacitive sensing
cpscon1=0;
sspcon=0; // Disable serial port SPI

trisa=0b11000000;
trisb=0b11000000;
trisc=0b11000000;

porta=0xaa;
portb=255;
while(1);
}

----

 

Which compiles to the ASM code below

 

main
; { main; function begin
BSF STATUS, RP0
BSF STATUS, RP1
CLRF gbl_ansela
BCF STATUS, RP0
BCF STATUS, RP1
CLRF gbl_adcon0
BSF STATUS, RP0
CLRF gbl_adcon1
BCF STATUS, RP0
BSF STATUS, RP1
CLRF gbl_cpscon0
CLRF gbl_cpscon1
BCF STATUS, RP1
CLRF gbl_sspcon
MOVLW 0xC0
BSF STATUS, RP0
MOVWF gbl_trisa
MOVWF gbl_trisb
MOVWF gbl_trisc
MOVLW 0xAA
BCF STATUS, RP0
MOVWF gbl_porta
MOVLW 0xFF
MOVWF gbl_portb
label1
GOTO	label1
; } main function end

 

----

 

Observations

 

1) When stepped using the debug mode stepping through TRISA load and the debug register for TRISA remains 0000 -- Unexpected

2) Stepping through next line TRISB load, both PORTB and TRISB registers seem to display 0xc0 (from 00) -- Unexpected

3) Stepping through TRISC load, TRISB register displays correctly.

4) Stepping through the PORTA load, the displayed register remains firmly at 0x00 -- Unexpected

5) Stepping through the PORTB load, the displayed value is 0xff which is correct.

 

Unless I have misunderstood how this simple program should work, the debug stepper does not behave as I expect. Is this a bug? or can some one enlighten me. This is repeatable.

 

Many thanks

 

C.

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×