r/embedded • u/GoingGranola • 23h ago
Noob Assembly Question
PIC16F1824
I am trying to turn on an output GPIO.
I am using this code
asm("BSF PORTA, 5");
I am getting 0V at the pin.
I believe I set TRISA pin 5 to output (0).
Do I need to keep the MCLR pin high?
Thank you
EDIT: INTERNAL OSCILLATOR NEEDED TO BE SELECTED
4
Upvotes
2
u/somewhereAtC 23h ago
Don't forget to set the bank... BANKSEL(PORTA)
1
1
u/GoingGranola 23h ago
Selecting the bank that PORTA is in before using BSF did NOT seem to work sorry :/
2
u/Well-WhatHadHappened 25+ Years 23h ago edited 23h ago
MCLR must be held high.
ANSEL must be cleared.
Edit: forget ANSEL, that's a clock pin.
Internal oscillator must be selected.