Is it possible to change the timer prescaler to give a faster Tick? (Arduino UNO/Nano(328)) Or is there a better way to generate regular fast interrupts?
My attempt to change the Timer Control register with RunNative. Didn't work
The program compiled ok and was downloaded to the UNO but it made no difference whether the RunNative code was present or not.
My attempt to change the Timer Control register with RunNative. Didn't work
B4X:
Private Sub AppStart
Serial1.Initialize(9600)
Timer1.Initialize("Timer1_Tick", 500)
Timer1.Enabled = True 'don't forget to enable it
RunNative("SetT1PS",Null) 'attempt to change the timer prescaler
#If C
void SetT1PS(B4R::Object* o) {
ULong *TCCR1B = _SFR_MEM8(0x81) //address of timer/counter 1B control register
TCCR1B = 1;
}
#End if
End Sub
The program compiled ok and was downloaded to the UNO but it made no difference whether the RunNative code was present or not.