hello, i use this and work:
read I,b1.HIGHBYTE ' read byte type var from EEprom
read I+1,b1.LOWBYTE 'read byte type var from EEprom
TEmpDs18(L) = B1 'word array
hello, i use this and work:
read I,b1.HIGHBYTE ' read byte type var from EEprom
read I+1,b1.LOWBYTE 'read byte type var from EEprom
TEmpDs18(L) = B1 'word array
Well it turns out the more intuitive way is also a little faster. That is if I
have done this correctly.
I used [view] [program memory] in MPLab and counted the number of
instructions between the start and end labels.
This code was 18 lines:
This code was 16 lines:Code:StartTest: adcData.lowbyte[Index] = ADRESL adcData.lowbyte[Index+1] = ADRESH EndTest:
So as long as I can afford the extra word variable, I will be using theCode:StartTest: tempWord.highbyte = ADRESH tempWord.lowbyte = ADRESL adcdata[index] = tempword EndTest:
temp variable way...... unless someone else reveals a clever trick.
thanks all for your replies,
Mike -
If ADRESH & ADRESL are consecutive SFR... then you could use
But I doubt ADRESL/ADRESH are consecutive in many PIC.Code:@ADRESULT = ADRESL ADRESULT VAR WORD EXT MyArray VAR WORD [8] Start: MyArray[0] = ADRESULT
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
mister_e,
Thats a good trick. One to remember. And it only produces 9 lines of
instruction. But your right, the PIC I'm using (16F684), ADRESH/L are not
next to each other.
Actually, ACCON0 is after ADRESH. That would give you an interesting result.
thanks,
Mike -
Bookmarks