H howard bassen Member Licensed User Longtime User Jan 14, 2017 #1 How do I insert the following command to set the analog to digital converter to a higher speed REG_ADC_MR = (REG_ADC_MR & 0xFFF0FFFF) | 0x00020000
How do I insert the following command to set the analog to digital converter to a higher speed REG_ADC_MR = (REG_ADC_MR & 0xFFF0FFFF) | 0x00020000
Erel B4X founder Staff member Licensed User Longtime User Jan 15, 2017 #2 You can use RunNative to call native code: B4X: Private Sub AppStart Serial1.Initialize(115200) Log("AppStart") RunNative("SetA2DSpeed", Null) End Sub #if C void SetA2DSpeed (B4R::Object* u) { REG_ADC_MR = (REG_ADC_MR & 0xFFF0FFFF) | 0x00020000; } #End If I'm not sure where does this code come from however I'm getting the following error: 'REG_ADC_MR' was not declared in this scope Upvote 0
You can use RunNative to call native code: B4X: Private Sub AppStart Serial1.Initialize(115200) Log("AppStart") RunNative("SetA2DSpeed", Null) End Sub #if C void SetA2DSpeed (B4R::Object* u) { REG_ADC_MR = (REG_ADC_MR & 0xFFF0FFFF) | 0x00020000; } #End If I'm not sure where does this code come from however I'm getting the following error: 'REG_ADC_MR' was not declared in this scope
H howard bassen Member Licensed User Longtime User Jan 15, 2017 #3 Thanks for the information. I forgot to mention that this is for the Arduino due. Would that make the difference? Upvote 0
Thanks for the information. I forgot to mention that this is for the Arduino due. Would that make the difference?
Erel B4X founder Staff member Licensed User Longtime User Jan 16, 2017 #4 This probably explain the error I got. The B4R code should be the same. Upvote 0