0
\$\begingroup\$

I have this simple program:

#include <p16f1503.inc>
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _BOREN_OFF & _CLKOUTEN_ON
__CONFIG _CONFIG2, _WRT_OFF & _STVREN_OFF & _LVP_OFF

    org      0x00
    goto     setup

setup
    banksel  OSCCON
    movlw    b'01101010'  ; Int. osc. 4 MHz
    movwf    OSCCON

    banksel  OPTION_REG
    BCF      OPTION_REG, TMR0CS 

    banksel  ANSELA
    clrf     ANSELA   
    banksel  TRISA                    
    clrf     TRISA   

    goto     main_loop


main_loop
    nop
    goto     main_loop

    end

What I would like to do is to enable CLKOUT pin, but it doesn't work... Am I missing something?

I am using:

  • IDE: MPLAB X IDE v1.20
  • Compiler: MPASM v5.45

and integrated software simulator...

[EDIT]

CLKOUT works just fine.. But sadly not in simulator.... Can someone explain reason for this behaviour.

\$\endgroup\$

1 Answer 1

2
+100
\$\begingroup\$

I think the MPLAB SIM documentation sums up the issue perfectly:

MPLAB SIM only simulates to the register level, not the pin level, e.g., RB0 represents the value in bit0 of the PORTB register, not the value on the pin named RB0.

This makes sense as the simulator is a software model, and not actual device hardware.

Since CLKOUT is based on the chip hardware and isn't a SFR, it won't be simulated.

\$\endgroup\$
2
  • \$\begingroup\$ I hate using SE sites with iOS. The site is almost unusable! \$\endgroup\$ Commented Jun 19, 2012 at 1:26
  • \$\begingroup\$ Great! Exactly that was the missing piece of information I was looking for... \$\endgroup\$
    – PrimosK
    Commented Jun 19, 2012 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.