HI
william hill官网
,我有一个奇怪的问题与我的PIC16F87,无论我写什么给波尔塔反转。如果我写0引脚高,如果我写1引脚低。我已经在数据表上过了好几次,但都不知道什么样的寄存器或位我错过了设置/清除我使用一个非常简单的代码来设置POTA:它调用下面的查找表:当滚动查找表时,代码工作正常。但不是1高引脚和7低,我有1低引脚和7高。这不是什么大问题,因为我可以在使用波尔塔之前使用反相W,但是让我感到沮丧的是我看不到我错过了什么。有人有答案吗?
以上来自于百度翻译
以下为原文
Hi Forum,
I have a strange issue with my PIC16F887 where whatever I write to PORTA gets inverted. If i write 0 the pin goes high, if i write 1 the pin goes low. I've been over the datasheet several
times but can't figure out what register or bit i missed to set/clear
I'm using a very simple code to set PORTA:
SetLeds
bcf STATUS, RP0
bcf STATUS, RP1
movf currentOctA,w
call GetLedPort
movwf PORTA
return
which call the following lookup table:
GetLedPort
andlw b'00000111'
movwf lookuptemp
movlw HIGH tblLeds
movwf PCLATH
movfw lookuptemp
addlw LOW tblLeds
btfsc STATUS,C
incf PCLATH, F
movwf PCL
tblLeds
dt b'00000001'
dt b'00000010'
dt b'00000100'
dt b'00001000'
dt b'00010000'
dt b'00100000'
dt b'01000000'
dt b'00000000'
The code works as expected when scrolling through the lookup table. But instead of 1 high pin and 7 low, I have 1 low pin and 7 high. It's no big issue since I can use invert W before writing to PORTA, but it's frustrating that I can't see what I am missing. Anyone has the answer ?