Author: sebastien.lelong
Date: Wed Jul  8 09:51:59 2009
New Revision: 1096

Modified:
    trunk/test/unittest/16f88_adc.jalt

Log:
16F88/ADC: unittesting analog pin onfig

Modified: trunk/test/unittest/16f88_adc.jalt
==============================================================================
--- trunk/test/unittest/16f88_adc.jalt  (original)
+++ trunk/test/unittest/16f88_adc.jalt  Wed Jul  8 09:51:59 2009
@@ -162,3 +162,65 @@
  asm nop
  var byte adcon1_temp = ADCON1 & 0b_0100_0000
  test_byte(adcon1_temp) ;@assertEquals 64 test_compute_tad_adcs2
+
+;@jallib testcase test_all_analog_pins
+;@jallib use pic_8MHz
+;@jallib use self_test
+const byte ADC_NVREF = 0
+const bit ADC_HIGH_RESOLUTION = true
+const word ADC_RSOURCE = 2_500
+porta_direction = all_output
+portb_direction = all_output
+
+include adc
+adc_init()
+
+set_analog_pin(0)
+-- check pin on PORTA configured as inputs (1 is 0b0000_0001 => RA0)
+asm nop
+test_byte(TRISA)  ;@assertEquals 1 test_porta_pin_an0_input
+asm nop
+test_byte(TRISB)  ;@assertEquals 0 test_portb_pin_an0_input
+
+set_analog_pin(1)
+-- check pin on PORTA configured as inputs (3 is 0b0000_0011 => RA{0,1})
+asm nop
+test_byte(TRISA)  ;@assertEquals 3 test_porta_pin_an01_input
+asm nop
+test_byte(TRISB)  ;@assertEquals 0 test_portb_pin_an0_input
+
+set_analog_pin(2)
+-- check pin on PORTA configured as inputs (6 is 0b0000_0111 => RA{0,1,2})
+asm nop
+test_byte(TRISA)  ;@assertEquals 7 test_porta_pin_an012_input
+asm nop
+test_byte(TRISB)  ;@assertEquals 0 test_portb_pin_an0_input
+
+set_analog_pin(3)
+-- check pin on PORTA configured as inputs (6 is 0b0000_0111 =>  
RA{0,1,2,3})
+asm nop
+test_byte(TRISA)  ;@assertEquals 15 test_porta_pin_an0123_input
+asm nop
+test_byte(TRISB)  ;@assertEquals 0 test_portb_pin_an0_input
+
+set_analog_pin(4)
+-- check pin on PORTA configured as inputs (6 is 0b0000_0111 => RA{0,1,2})
+asm nop
+test_byte(TRISA)  ;@assertEquals 31 test_porta_pin_an01234_input
+asm nop
+test_byte(TRISB)  ;@assertEquals 0 test_portb_pin_an0_input
+
+set_analog_pin(5)
+-- check pin on PORTA configured as inputs (6 is 0b0000_0111 => RA{0,1,2})
+asm nop
+test_byte(TRISA)  ;@assertEquals 31 test_porta_pin_an012345_input
+asm nop
+test_byte(TRISB)  ;@assertEquals 64 test_portb_pin_an0_input
+
+set_analog_pin(6)
+-- check pin on PORTA configured as inputs (6 is 0b0000_0111 => RA{0,1,2})
+asm nop
+test_byte(TRISA)  ;@assertEquals 31 test_porta_pin_an0123456_input
+asm nop
+test_byte(TRISB)  ;@assertEquals 192 test_portb_pin_an0_input
+

--~--~---------~--~----~------------~-------~--~----~
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