Menu

#3100 pic14 16bit SFRs

open
nobody
PIC14
5
2020-10-27
2020-08-14
No

SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ez80_z80/z80n/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15 4.0.3 #11778 (MINGW64)

It seems some SFRs not well defined
in SDCC\non-free\include\pic14\pic12f1571.h
PWM1PR defined as:

extern __at(0x0D95) __sfr PWM1PR;

I guess it should be better to define it as:

extern __at(0x0D95) volatile unsigned short PWM1PR;

Simple test "PWM1PR = 0x1234;" at first case produce following:

MOVLW 0x34
MOVWF _PWM1PR

while second is much closer to expectations:

MOVLW 0x34
MOVWF _PWM1PR
MOVLW 0x12
MOVWF (_PWM1PR + 1)

BTW: microchip recommended way is to store low address of multibyte data at the last. Mean it should be better to store (_PWM1PR + 1) first.

Discussion

  • Sergey Belyashov

    • Category: other --> PIC14
     
  • Philipp Klaus Krause

    Thanks for the report. However, the pic ports currently does not have a maintainer, so I don't expect it to be fixed anytime soon.

     

Log in to post a comment.

Auth0 Logo