bug: XC8 register bitfield accessors used incorrectly across codebase #29
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wait-to-fix
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
daru/PICsense#29
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The XC8 DFP header defines peripheral register bits as struct members (FVRCONbits.FVREN, etc.), not as #define constants. Code was using bare bitfield names as if they were C bit-position constants, which only compiled due to XC8 quirks but produced wrong register values. Affected: FVR (ADFVR gain=0, never ready), WDT (reserved prescaler → ~1ms instead of 256s), ADC (channel selection + GO_nDONE), comparator, CPS. Fix: use RegisterNamebits.FieldName pattern throughout.
Fixed in PR #39: all peripheral register access now uses XC8 DFP bitfield accessors (e.g., FVRCONbits.FVREN instead of bare bitfield names).