Skip to content

CH552, sdcc and delay.c #4

Open
@dfxhub

Description

Hi! Delays are not correct.

sdcc 4.2.0 compiles your implemetation to this:

;	src/delay.c:25: SAFE_MOD++;                     // 2 Fsys cycles, for higher Fsys, add operation here
	mov	a,_SAFE_MOD
	inc	a
	mov	_SAFE_MOD,a

and it is not 2 Fsys cycles, so f.e. DLY_ms(1000) at 24MHz becomes ~2+ secs. While this is more correct (about 1.200 secs at 24MHz) (as of Blinkinlabs or official SDK):

;	src/delay.c:25: ++SAFE_MOD;                     // 2 Fsys cycles, for higher Fsys, add operation here
	inc	_SAFE_MOD

Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions