-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadc.tbh
40 lines (33 loc) · 1.55 KB
/
adc.tbh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
enum pic_prescaler_enum
PIC_PRE_64, '500KHz for CPU clock of 32MHz
PIC_PRE_16, '2Mhz for CPU clock of 32MHz
PIC_PRE_4, '8Mhz for CPU clock of 32MHz
PIC_PRE_1 '32Mhz for CPU clock of 32MHz
end enum
'====================================================
' GLOBAL VALUES
declare analog_period as byte
declare analog_period_counter as byte
declare analog_float_values(MAX_ANALOG_LINES) as real
declare analog_values(MAX_ANALOG_LINES) as word
declare analog_last_values(MAX_ANALOG_LINES) as word
declare analog_pwm_pulse(MAX_ANALOG_LINES) as word
declare analog_pwm_period(MAX_ANALOG_LINES) as word
declare analog_pwm_prescaler(MAX_ANALOG_LINES) as pic_prescaler_enum
declare analog_pwm_enable(MAX_ANALOG_LINES) as boolean
declare analog_pwm_change(MAX_ANALOG_LINES) as boolean
'====================================================
declare sub analog_setup()
declare sub analog_loop()
declare function analog_set(channel as word, value as word, pwm_select as boolean) as boolean
declare function analog_pwm_set(channel as byte, pulse as word) as boolean
declare sub analog_pic_pwm_start(slot as byte, pin as byte)
declare sub analog_pic_pwm_stop(slot as byte, pin as byte)
declare function analog_pwm_onoff(channel as byte, en as boolean) as boolean
' I2C declare
declare sub analog_i2c_init(slot as byte)
declare sub analog_i2c_get(slot as byte, ssi_num as byte, ssi_baudrate as byte)
declare sub analog_i2c_start(slot as byte)
declare sub analog_i2c_stop(slot as byte)
declare sub analog_i2c_write(data as byte)
declare function analog_i2c_read(acknak_request as boolean) as byte