Status: Assigned
Owner: [email protected]
Labels: Type-Defect Priority-Medium

New issue 77 by [email protected]: adc_read_low_res 10->8 bits shift not  
correct
http://code.google.com/p/jallib/issues/detail?id=77

What steps will reproduce the problem?
1. Shifting from 10->8 bits not correct

The original code:
       ;;asm  rrf   adc_hbyte,f
       ;;asm  rrf   adc_value,f
       ;;asm  rrf   adc_hbyte,f
       ;;asm  rrf   adc_value,f

is replaced by
          adc_hbyte = adc_hbyte >> 1
          adc_value = adc_value >> 1
          adc_hbyte = adc_hbyte >> 1
          adc_value = adc_value >> 1

which is not the same, since the carry is explicitly cleared in jal


   141    adc_hbyte = adc_hbyte >> 1
                                bcf      v__status, v__c,v__access
                                rrf      v___adc_hbyte_2,f,v__banked


In order to get the correct result, you need to shift it as word instead:


var word shift_alias at adc_hbyte

adc_hbyte = adc_hbyte >> 1
adc_hbyte = adc_hbyte >> 1

adc_hbyte[0] no contains the low byte result (10->8 bits shift)




--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to