问题描述
我有一个工作代码,它使用 p16f1829 在 2 个 LED 显示器上显示两位数字。但是,当我尝试包含一个收集 ADC 转换结果以显示在 LED 显示屏上的代码块时出现问题(见下文)。
struct Animal *to_allocate,array[];
更准确地说,它似乎发生在我试图从查找表中获取相应值的时候(见下文):
该指令后 W-reg 中的结果应为 0x7D。但是,它退出查找表而不返回预期值。
没有 ADC 模块的原始工作代码如下:
A2D:
; Start the ADC
nop ; Requried ADC delay of 8uS => (1/(Fosc/4)) = (1/(500KHz/4)) = 8uS
BANKSEL ADCON0 ; Selects memory bank containing ADCON0 register
BSF ADCON0,GO ; Start the ADC
BTFSC ADCON0,GO ; This bit will be cleared when the conversion is complete
GOTO $-1 ; Keep checking the above line until GO bit is clear
; Grab Results and write to the LEDs
SWAPF ADRESH,w ; Get the top 4 MSbs (remember that the ADC result is LEFT justified!)
MOVWF L0
RETURN
我尝试了各种方法,目前对如何进行有一个心理障碍。任何人都可以提供的任何见解将不胜感激。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)