Revision: 1267
Author: robhamerling
Date: Sat Aug 29 13:03:46 2009
Log:
  Fixed validation violations.


http://code.google.com/p/jallib/source/detail?r=1267

Modified:
  /trunk/sample/16f886_pwm_adc_freq.jal
  /trunk/sample/16f886_pwm_adc_res.jal

=======================================
--- /trunk/sample/16f886_pwm_adc_freq.jal       Sat Aug 29 05:44:33 2009
+++ /trunk/sample/16f886_pwm_adc_freq.jal       Sat Aug 29 13:03:46 2009
@@ -45,12 +45,12 @@
  const byte LCD_ROWS   = 2                       -- 2 lines
  const byte LCD_CHARS  = 16                      -- 16 chars per line

-alias    lcd_D4   is pin_B0                     -- LCD data  port
-alias    lcd_D5   is pin_B1                     -- LCD data  port
-alias    lcd_D6   is pin_B2                     -- LCD data  port
-alias    lcd_D7   is pin_B3                     -- LCD data  port
-alias    lcd_EN   is pin_C5                     -- LCD command/data select.
-alias    lcd_RS   is pin_C4                     -- LCD data trigger
+alias    lcd_d4   is pin_B0                     -- LCD data  port
+alias    lcd_d5   is pin_B1                     -- LCD data  port
+alias    lcd_d6   is pin_B2                     -- LCD data  port
+alias    lcd_d7   is pin_B3                     -- LCD data  port
+alias    lcd_en   is pin_C5                     -- LCD command/data select.
+alias    lcd_rs   is pin_C4                     -- LCD data trigger
  PORTB_low_direction   = all_output
  PORTC_high_direction  = all_output

@@ -77,53 +77,53 @@
  include format                                  -- data formatting
  include delay                                   -- delay library

-const byte strPR2[]     = "PR2="
-const byte strR1L[]     = "R1L="
-const byte strR2L[]     = "R2L="
-
-var word measure_A                              -- ADC channel A
-var word measure_B                              -- ADC channel B
+const byte strpr2[]     = "PR2="
+const byte strr1l[]     = "R1L="
+const byte strr2l[]     = "R2L="
+
+var word measure_a                              -- ADC channel A
+var word measure_b                              -- ADC channel B

  procedure show_data(byte in no) is
     lcd_clear_screen()
     lcd = "0" + no
     lcd = "."
-   print_string(lcd, strPR2)
+   print_string(lcd, strpr2)
     format_byte_hex(lcd, PR2)
-   format_word_dec(lcd, measure_A, 4, 0)
-   format_word_dec(lcd, measure_B, 4, 0)
+   format_word_dec(lcd, measure_a, 4, 0)
+   format_word_dec(lcd, measure_b, 4, 0)
     lcd_cursor_position(1,0)
-   print_string(lcd, strR1L)
+   print_string(lcd, strr1l)
     format_byte_hex(lcd, CCPR1L)
     lcd = " "
-   print_string(lcd, strR2L)
+   print_string(lcd, strr2l)
     format_byte_hex(lcd, CCPR2L)
     delay_100ms(30)
  end procedure

  forever loop

-   measure_A = adc_read(ADC_CHANNEL_A)                      -- read  
potmeter 1
-   measure_B = adc_read(ADC_CHANNEL_B)                      -- read  
potmeter 2
+   measure_a = adc_read(ADC_CHANNEL_A)                      -- read  
potmeter 1
+   measure_b = adc_read(ADC_CHANNEL_B)                      -- read  
potmeter 2

     pwm_set_frequency(75000)                                 -- set high  
PWM frequency

-   pwm1_set_dutycycle_lowres(byte(measure_A / 4))           -- max 8 bits!
-   pwm2_set_dutycycle_lowres(byte(measure_B / 4))
+   pwm1_set_dutycycle_lowres(byte(measure_a / 4))           -- max 8 bits!
+   pwm2_set_dutycycle_lowres(byte(measure_b / 4))
     show_data(1)

-   pwm1_set_percent_dutycycle(byte(measure_A / 32))         -- limit value!
-   pwm2_set_percent_dutycycle(byte(measure_B / 32))
+   pwm1_set_percent_dutycycle(byte(measure_a / 32))         -- limit value!
+   pwm2_set_percent_dutycycle(byte(measure_b / 32))
     show_data(2)

     pwm_set_frequency(150000)                                -- set high  
PWM frequency

-   pwm1_set_dutycycle_lowres(byte(measure_A / 8))           -- max 7 bits!
-   pwm2_set_dutycycle_lowres(byte(measure_B / 8))
+   pwm1_set_dutycycle_lowres(byte(measure_a / 8))           -- max 7 bits!
+   pwm2_set_dutycycle_lowres(byte(measure_b / 8))
     show_data(3)

-   pwm1_set_percent_dutycycle(byte(measure_A / 32))         -- limit value!
-   pwm2_set_percent_dutycycle(byte(measure_B / 32))
+   pwm1_set_percent_dutycycle(byte(measure_a / 32))         -- limit value!
+   pwm2_set_percent_dutycycle(byte(measure_b / 32))
     show_data(4)

  end loop
=======================================
--- /trunk/sample/16f886_pwm_adc_res.jal        Sat Aug 29 05:44:33 2009
+++ /trunk/sample/16f886_pwm_adc_res.jal        Sat Aug 29 13:03:46 2009
@@ -45,12 +45,12 @@
  const byte LCD_ROWS   = 2                       -- 2 lines
  const byte LCD_CHARS  = 16                      -- 16 chars per line

-alias    lcd_D4   is pin_B0                     -- LCD data  port
-alias    lcd_D5   is pin_B1                     -- LCD data  port
-alias    lcd_D6   is pin_B2                     -- LCD data  port
-alias    lcd_D7   is pin_B3                     -- LCD data  port
-alias    lcd_EN   is pin_C5                     -- LCD command/data select.
-alias    lcd_RS   is pin_C4                     -- LCD data trigger
+alias    lcd_d4   is pin_B0                     -- LCD data  port
+alias    lcd_d5   is pin_B1                     -- LCD data  port
+alias    lcd_d6   is pin_B2                     -- LCD data  port
+alias    lcd_d7   is pin_B3                     -- LCD data  port
+alias    lcd_en   is pin_C5                     -- LCD command/data select.
+alias    lcd_rs   is pin_C4                     -- LCD data trigger
  PORTB_low_direction   = all_output
  PORTC_high_direction  = all_output

@@ -77,26 +77,26 @@
  include format                                  -- data formatting
  include delay                                   -- delay library

-const byte strPR2[]     = "PR2="
-const byte strR1L[]     = "R1L="
-const byte strR2L[]     = "R2L="
-
-var word measure_A                              -- ADC measurement value
-var word measure_B                              -- ADC measurement value
+const byte strpr2[]     = "PR2="
+const byte strr1l[]     = "R1L="
+const byte strr2l[]     = "R2L="
+
+var word measure_a                              -- ADC measurement value
+var word measure_b                              -- ADC measurement value

  procedure show_data(byte in no) is
     lcd_clear_screen()
     lcd = "0" + no
     lcd = "."
-   print_string(lcd, strPR2)
+   print_string(lcd, strpr2)
     format_byte_hex(lcd, PR2)
-   format_word_dec(lcd, measure_A, 4, 0)
-   format_word_dec(lcd, measure_B, 4, 0)
+   format_word_dec(lcd, measure_a, 4, 0)
+   format_word_dec(lcd, measure_b, 4, 0)
     lcd_cursor_position(1,0)
-   print_string(lcd, strR1L)
+   print_string(lcd, strr1l)
     format_byte_hex(lcd, CCPR1L)
     lcd = " "
-   print_string(lcd, strR2L)
+   print_string(lcd, strr2l)
     format_byte_hex(lcd, CCPR2L)
     delay_100ms(30)
  end procedure
@@ -105,23 +105,23 @@

  forever loop

-   measure_A = adc_read(ADC_CHANNEL_A)                      -- read  
potmeter 1
-   measure_B = adc_read(ADC_CHANNEL_B)                      -- read  
potmeter 2
-
-   pwm1_set_dutycycle_highres(measure_A)
-   pwm2_set_dutycycle_highres(measure_B)
+   measure_a = adc_read(ADC_CHANNEL_A)                      -- read  
potmeter 1
+   measure_b = adc_read(ADC_CHANNEL_B)                      -- read  
potmeter 2
+
+   pwm1_set_dutycycle_highres(measure_a)
+   pwm2_set_dutycycle_highres(measure_b)
     show_data(1)

-   pwm1_set_dutycycle(byte(measure_A / 4))
-   pwm2_set_dutycycle(byte(measure_B / 4))
+   pwm1_set_dutycycle(byte(measure_a / 4))
+   pwm2_set_dutycycle(byte(measure_b / 4))
     show_data(2)

-   pwm1_set_dutycycle_lowres(byte(measure_A * 4))
-   pwm2_set_dutycycle_lowres(byte(measure_B * 4))
+   pwm1_set_dutycycle_lowres(byte(measure_a * 4))
+   pwm2_set_dutycycle_lowres(byte(measure_b * 4))
     show_data(3)

-   pwm1_set_percent_dutycycle(byte(measure_A * 25 / 256))   -- (factor  
100/1024)
-   pwm2_set_percent_dutycycle(byte(measure_B * 25 / 256))
+   pwm1_set_percent_dutycycle(byte(measure_a * 25 / 256))   -- (factor  
100/1024)
+   pwm2_set_percent_dutycycle(byte(measure_b * 25 / 256))
     show_data(4)

  end loop

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