Author | Stef Mientki, Copyright (c) 2002..2008, all rights reserved. |
Adapted-by | Sebastien Lelong. |
Compiler | >=2.4k |
library to handle ADC peripheral. - support both low and high resolution mode - support a large number of PICs, with - ADC pin configuration - channel selection - clock selection - support Vref How to use it ? See http://justanotherlanguage.org/content/jallib/tutorials/tutorial_adc_intro
this is a heavy refactoring/rewriting of original library from Stef Mientki. The main changes are about ADC configuration, which are essentially handled in adc_channels.jal and adc_clock.jal. About Vref setup: - when ADC_NVREF = ADC_NO_VREF : there's no Vref pin used, vref is done internally, using power supply (Vdd, Vss) - when ADC_NVREF = ADC_VREF_POS ): there's only one Vref pin, this is Vref+ - when ADC_NVREF = ADC_VREF_POS_NEG : two Vref pins are used, Vref+ and Vref- - when ADC_NVREF = ADC_VREF_NEG : there's only one Vref pin, this is Vref- A major trigger is when using ADC libs is ADC_DYNAMIC. When declared, several parameters become dynamic and can be changed at runtime. This includes: - ADC_NCHANNEL, the number of ADC channels (when they are dependent channels, as independent channels are always selected at runtime with set_analog_pin() - ADC_TEMP (careful, computation related to temperature very approximative - ADC_RESOLUTION (8-bits or 10-bits) - ADC_RSOURCE The original library can be found: - Stef's: http://mientki.ruhosting.nl/pic-tools/jal/libs2/adc_hardware.jal - jallib issue tracker: http://code.google.com/p/jallib/issues/detail?id=7
_adc_init_acquisition_delay()
_adc_setup()
_adc_read_low_res(byte in adc_chan, byte out adc_byte)
_adc_init_justify()
var byte adc_conversion_delay
No documentation found
var volatile byte _adcon0_shadow = 0
No documentation found
adc_read_bytes(byte in adc_chan, byte out adc_hbyte, byte out adc_lbyte)
Does an AD conversion on the selected channel returns the 10-bit result as 2 byte parameters It doesn't matter if ADC is set to low or high resolution
adc_init()
Initializes the PIC AD-converter, by calling the correct routine according to the number of external references Settings are done according to the special ADC constants Sets all the analog pins to input Calculates aquisition time and determines if right or left justification is optimal
_adc_init_acquisition_delay()
No documentation found
_adc_setup()
Pin setup: analog as input, configure Vref, ...
_adc_read_low_res(byte in adc_chan, byte out adc_byte)
Does an AD conversion with low resolution (8 bit) on the selected channel
_adc_init_justify()
No documentation found
adc_read(byte in adc_chan) return word
Does an AD conversion on the selected channel returns the result as a 10-bits word It doesn't matter if ADC is set to low or high resolution
adc_read_low_res(byte in adc_chan) return byte
Returns Low Resolution ADC-value as the RESULT It doesn't matter if ADC is set to low or high resolution
12f683 | 12f683_pwm_adc.jal |
16f723 | 16f723_adc_independent.jal |
16f73 | 16f73_adc_dependent.jal |
16f767 | 16f767_pwm_adc.jal |
16f77 | 16f77_adc_lowres.jal |
16f876a | 16f876a_adc.jal |
16f877 | 16f877_adc_dependent.jal |
16f877 | 16f877_adc.jal |
16f877a | 16f877a_adc_dependent.jal |
16f88 | 16f88_adc_independent.jal |
16f88 | 16f88_adc_lowres.jal |
16f88 | 16f88_adc_highres.jal |
16f886 | 16f886_pwm_adc_res.jal |
16f886 | 16f886_pwm_adc_freq.jal |
18f14k50 | 18f14k50_adc_independent.jal |
18f2450 | 18f2450_adc_dependent.jal |
18f4550 | 18f4550_adc.jal |
18f4550 | 18f4550_adc_dependent.jal |
18f4550 | 18f4550_dynamic_adc.jal |
Author | Sebastien Lelong, Copyright (C) 2009, all rights reserved. |
Adapted-by | |
Compiler | 2.4n |
this library acts as a wrapper. When included, it'll define ways to configure the number ADC channels. There are 3 different cases: 1. the number of channels is specified setting/clearing PCFG bits => a combination of PCFG bits selects a given number of ADC channels. It is not possible to independently select which pins as ADC pins. If available (1.a), Vref+ and Vref- are part of these combinations. If not (1.b), either PIC doesn't support voltage reference, or in some few cases, Vref+ and Vref- are handled separately via VCGF bits. PCFG bits are in ADCON1, as ADCON1_PCFG 2. the number of channels is specified clearing PCFG bits (case only found in 18F, I think) => pins can be configured independently (you can decide which pin will act as an analog pin, and define your own combination Vref+/Vref- are configured using VCFG bits. PCFG bits are in ADCON0 and ADCON1, and are numbered (eg. ADCON_PCFG5) 3. the number of channels is set using ANS bits (18F and non-18F) => same as case 2., channels can be configured independently Vref+/Vref- are configured using VCFG bits.
this file is generated, don't modify it directly...
No dependency found
_adc_vref_adref()
Configure Voltage reference using ADREF bits Found in PICs: 16f722, 16f723, 16f724, 16f726, 16f727, 16lf722, 16lf723, 16lf724, 16lf726, 16lf727, Same family, DS 41341B
_adc_vref_adpref_adnref()
No documentation found
_adc_vref_vcfg()
Configure Voltage reference using VCFG bits
Author | Rob Hamerling , Copyright (c) 2010, all rights reserved. |
Adapted-by | Rob Hamerling (set ACQT bits to 0b000). |
Compiler | 2.4n |
This library provides a procedure to configure ADC clock according to ADC constraints about Tad values and PIC's clock speed . Selecting the appropriate ADC clocking is critical. Not all PICs have the same min/max values for Tad. See the ADC-chapter in the datasheet for the actual limits. Some PICs can go faster than 20MHz, like 18F. LF-PICs don't follow the same rules as the F-PICS (see 18F4550 and 18LF4550 for instance). How to obtain a general rule of thumb? For some popular PICs we find: For 16F88, and for many other PICs: 1.6 < Tad < 6.4 (microseconds) For 18F4550 (and other 18F PICs): 0.8 < Tad < 25 (microseconds) . The ADC libraries use 2 constants as minimum and maximum Tad values. The constants should contain a value 10 times as large as these limits expressed in microseconds. The following values are used by the library as defaults: . for 18F family: ADC_MIN_TAD = 8 (0.8 us) ADC_MAX_TAD = 250 (25 us) . for other PICs: ADC_MIN_TAD = 16 (1.6 us) ADC_MAX_TAD = 250 (16 us) . When these values are not acceptable alternate values may be specified by the user *** before *** including the ADC library. . The library will select the shortest possible Tad. A warning will be issued when it is not possible to derive a value for Tad within the limits of ADC_TAD_MIN and ADC_TAD_MAX with the current clock speed. In that case the internal RC oscillator of the ADC module will be selected automatically (Frc). When this is not desired alternate values for ADC_TAD_MIN and/or ADC_TAD_MAX must be specified, or an alternate clock speed must be used.
- This is a rewrite of a previous version of this library. - The device files contain a constant ADC_ADCS_BITCOUNT to indicate the number of bits of the ADCS variable of 'this' PIC. Clock devider selection bits (ADCS) can bit*2 or bit*3 or none. - when bit*2: divisor is 2, 8 or 32 - when bit*3: divisor is 2, 4, 8, 16, 32 or 64 ADCS bits may be scattered over different registers. When this is the case the device file contains a pseudo-variable ADCON0_ADCS to hide the scattering. Some PICs with ADC module have no ADCS bits at all (10F220/220)!
No dependency found
var byte tad_value
Calculated Tad value (result of procedure _adc_init_clock())
_adc_init_clock()
Set ADCS bits to obtain correct ADC timing
Author | Stef Mientki, Copyright (c) 2002..2008, all rights reserved. |
Adapted-by | Sebastien Lelong. |
Compiler | >=2.4g |
library to use the PIC's AD converter See 16F87x datasheet (DS30292C, p112) Number of channels, behind "--" yields only for 16F874 and 16F877 No external Vref: Nchan = 1,3,5 -- 6,8 Only external +Vref: Nchan = 2,4 -- 5,7 Both external +Vref and - Vref: Nchan = 1,2,3 -- 4,6 Analog channels can still be used as digital outputs, by setting pin = output relevant IO pins * RA0 = AN0 * RA1 = AN1 * RA2 = AN2 or -Vref * RA3 = AN3 or +Vref * RA4 = no analog IO * RA5 = AN4 * next pins only for 16F874 and 16F877 * RE0 = AN5 * RE1 = AN6 * RE2 = AN7 Example PIC-AD (if you use JALcc, you can copy the complete example below and "uncomment" it) define the AD converter settings const ADC_hardware_Nchan = 2 ;number of selected channels const ADC_hardware_NVref = 0 ;number of external references const ADC_hardware_Rsource = 10_000 ;maximum source resistance const ADC_hardware_high_resolution = true ;true = high resolution = 10 bits ;false = low resolution = 8 bits get the library, after defining the constants include adc_hardware initialize the AD converter according to the above parameters ADC_init now take a sample read high resolution, channel 0 var_word=adc_read(0) read low resolution, channel 0 var_byte=adc_read_low_res(0)
I (Stef) mixed the following libraries with my own ideas * f877_modules.jal from Javier Martinez * janalog.jal from Vasile Surducan
_adc_read_low_res(byte in adc_chan, byte out adc_byte)
_adc_init_2_vref()
_adc_init_1_vref()
_adc_init_no_vref()
_ad_init_general()
var volatile byte _adc_acquisition_time
No documentation found
var volatile byte _adcon0_shadow = 0
No documentation found
adc_read_bytes(byte in adc_chan, byte out adc_hbyte, byte out adc_lbyte)
Does an AD conversion on the selected channel returns the 10-bit result as 2 byte parameters It doesn't matter if ADC is set to low or high resolution
adc_on()
Turns all ADC channels back on
adc_init()
Initializes the PIC AD-converter, by calling the correct routine according to the number of external references Settings are done according to the special ADC constants Sets all the analog pins to input Calculates aquisition time and determines if right or left justification is optimal
_adc_read_low_res(byte in adc_chan, byte out adc_byte)
Does an AD conversion with low resolution (8 bit) on the selected channel
_adc_init_2_vref()
Initializes the PIC AD-converter, when both +Vref and -Vref are present Settings are done according to the special ADC constants Sets all the analog pins to input Calculates aquisition time and determines if right or left justification is optimal
_adc_init_1_vref()
Initializes the PIC AD-converter, when only +Vref is present Settings are done according to the special ADC constants Sets all the analog pins to input Calculates aquisition time and determines if right or left justification is optimal
_adc_init_no_vref()
Initializes the PIC AD-converter, when no external Vref is present Settings are done according to the special ADC constants Sets all the analog pins to input Calculates aquisition time and determines if right or left justification is optimal
_ad_init_general()
Internal routine, that calculates aquisition time and determines if right or left justification is optimal
adc_read(byte in adc_chan) return word
Does an AD conversion on the selected channel returns the result as a 10-bits word It doesn't matter if ADC is set to low or high resolution
adc_read_low_res(byte in adc_chan) return byte
Returns Low Resolution ADC-value as the RESULT It doesn't matter if ADC is set to low or high resolution
18f14k50 | 18f14k50_usb_hid_generic.jal |
18f2450 | 18f2450_usb_hid_generic.jal |
18f4550 | 18f4550_usb_hid_generic.jal |
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4m |
This library allows creation of bit arrays with up to 16383 entries.
No dependency found
const byte _BIT_ARRAY_1_CALC2 = _BIT_ARRAY_1_CALC1 * 8
const byte _BIT_ARRAY_1_CALC1 = BIT_ARRAY_1_SIZE / 8
const byte _BIT_ARRAY_1_CALC3 = BIT_ARRAY_1_SIZE - _BIT_ARRAY_1_CALC1
const word _BIT_ARRAY_1_ARRAY_SIZE = (BIT_ARRAY_1_SIZE / 8)+ 1
const byte _BIT_ARRAY_1_CALC2 = _BIT_ARRAY_1_CALC1 * 8
No documentation found
const byte _BIT_ARRAY_1_CALC1 = BIT_ARRAY_1_SIZE / 8
create a byte array to hold the bits
const byte _BIT_ARRAY_1_CALC3 = BIT_ARRAY_1_SIZE - _BIT_ARRAY_1_CALC1
No documentation found
const word _BIT_ARRAY_1_ARRAY_SIZE = (BIT_ARRAY_1_SIZE / 8)+ 1
No documentation found
bit_array_1'put(word in address, bit in data)
Write to bit array
_bit_array_1_set_byte(word in byte_address, byte in bit_address, bit in data)
Writes one bit to the correct byte array (internal use only)
bit_array_1'get(word in address) return bit
Read from bit array
_bit_array_1_get_byte(word in byte_address, byte in bit_address) return bit
Reads one bit from the correct byte array (internal use only)
18f452 | 18f452_bit_array.jal |
18f4525 | 18f4525_bit_array.jal |
18f4550 | 18f4550_bit_array.jal |
18f4620 | 18f4620_bit_array.jal |
18f67j50 | 18f67j50_bit_array.jal |
Author | Eur van Andel, Copyright (c) 2008, all rights reserved. |
Adapted-by | |
Compiler | >=2.4h |
This library has only one fuction: calendar(). It assumes the following variables: var volatile byte seconds (typically updated by an ISR) var byte hours, minutes, date, month var word year It knows the leap years until 2099.
No dependency found
calendar()
should be called at least once a minute
16f876a | 16f876a_rtc_lcd.jal |
16f877a | 16f877a_rtc_lcd.jal |
16f886 | 16f886_rtc_lcd_20mhz.jal |
16f886 | 16f886_rtc_lcd_4mhz.jal |
16f886 | 16f886_rtc_lcd_125khz.jal |
18f2620 | 18f2620_rtc_tmr3.jal |
Author | William Welch Copyright (c) 2010, all rights reserved. |
Adapted-by | |
Compiler | 2.4m |
bridge/gateway between RS232 and CAN bus. Uses ASCII encapsulation, compatible with the Socket-CAN SLCAN API, and adapters such as LAWICEL and VScom USB-CAN.
Socket-CAN, in particular the SLCAN API. http://developer.berlios.de/projects/socketcan/ also, the LAWICEL CAN-USB and Easylink adapter manuals.
No dependency found
var volatile byte can_ascii_rxcnt = 0
var volatile byte can_ascii_rxbuf[32]
var bit can_adapter_is_open = 0
can_open_cmd(volatile byte out device, byte in ascii_buf[32]) return bit
can_closed_cmd(volatile byte out device, byte in ascii_buf[32]) return bit
can_check_can_rx(volatile byte out device, dword in out can_id, byte in out can_data[8], byte in out data_len) return bit
can_modeless_cmd(volatile byte out device, byte in ascii_buf[32]) return bit
var volatile byte can_ascii_rxcnt = 0
No documentation found
var volatile byte can_ascii_rxbuf[32]
No documentation found
var bit can_adapter_is_open = 0
No documentation found
can_check_uart_rx(volatile byte out device, byte in ch)
this routine is used to process incoming characters from the UART. the data stream is line-oriented ASCII, with a CR(13) terminator. sometimes the data is a command, which may need a reply back out the UART. But most of the time, the data is encapsulated CAN messages which need to be sent out the CANbus. device: uart data device, e.g. serial_hw_data ch: received ASCII char from UART
_can_pdec8(volatile byte out device, byte in n)
No documentation found
can_open_cmd(volatile byte out device, byte in ascii_buf[32]) return bit
these commands are only valid while the bridge is 'open' this routine is primarily for internal use.
can_closed_cmd(volatile byte out device, byte in ascii_buf[32]) return bit
these commands are only valid while the bridge is 'closed' this routine is primarily for internal use.
can_check_can_rx(volatile byte out device, dword in out can_id, byte in out can_data[8], byte in out data_len) return bit
this routine encapsulates incoming CANbus messages, and sends the resulting ASCII out to the UART. a copy of the CANbus message is also returned to the caller. device: uart device, e.g. serial_hw_data
can_modeless_cmd(volatile byte out device, byte in ascii_buf[32]) return bit
these commands are always available this routine is primarily for internal use.
18f2585 | 18f2585_can_serial_adapter.jal |
18f2585 | 18f2585_canid4_serial_adapter.jal |
Author | William Welch Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | 2.4m |
ASCII-to-CAN and CAN-to-ASCII routines. The intent is to be compatible with the SLCAN API. These routines may be used, for example, to implement a RS232 to CAN adapter
Socket-CAN, in particular the SLCAN API. http://developer.berlios.de/projects/socketcan/ also, the LAWICEL CAN-USB adapter.
No dependency found
can_to_ascii(dword in can_id, byte in can_data[8], byte in data_len, byte out ascii_buf[32]) return byte
ascii_to_can(byte in ascii_buf[32], dword out can_id, byte out can_data[8], byte out data_len) return bit
can_to_ascii(dword in can_id, byte in can_data[8], byte in data_len, byte out ascii_buf[32]) return byte
convert CAN message to socket-CAN SLCAN API FIXME: poor method.
ascii_to_can(byte in ascii_buf[32], dword out can_id, byte out can_data[8], byte out data_len) return bit
convert ASCII message to CAN message, as per socket-CAN SLCAN API FIXME: poor method.
_ascii2bin(byte in c) return byte
No documentation found
18f2585 | 18f2585_canid4_monitor.jal |
18f2585 | 18f2585_can_serial_adapter.jal |
18f2585 | 18f2585_canid4_serial_adapter.jal |
18f2585 | 18f2585_can_serial_hw.jal |
18f4585 | 18f4585_canid4_monitor.jal |
Author | William Welch and Eur van Andel Copyright (c) 2010, all rights reserved. |
Adapted-by | |
Compiler | 2.4m |
implements LED blinks compatible with CANopen spec.
Cia Draft Recommendation 303, Part 3, Indicator specification
No dependency found
var byte can_led_green_func = CANLED_OFF
const CANLED_OFF = 0
var byte can_led_green_opcode = CANLED_OFF
var byte can_led_red_opcode = CANLED_OFF
var byte can_led_state = 0
const CANLED_1FLASH = 0x18
var byte can_led_red_func = CANLED_OFF
const CANLED_2FLASH = 0x28
const CANLED_FLASH = 8
const CANLED_RED_ON = 2
const CANLED_3FLASH = 0x38
const CANLED_GREEN_ON = 1
const CANLED_4FLASH = 0x48
const CANLED_BLINK = 4
can_red_2flash()
can_set_leds(byte in x)
can_green_on()
can_led_delay100ms(word in n)
can_led_poll()
can_red_4flash()
can_red_off()
can_red_1flash()
can_green_3flash()
can_green_1flash()
can_green_2flash()
can_green_blink()
can_red_on()
can_red_blink()
can_green_off()
can_red_3flash()
var byte can_led_green_func = CANLED_OFF
No documentation found
const CANLED_OFF = 0
No documentation found
var byte can_led_green_opcode = CANLED_OFF
No documentation found
var byte can_led_red_opcode = CANLED_OFF
No documentation found
var byte can_led_state = 0
No documentation found
const CANLED_1FLASH = 0x18
No documentation found
var byte can_led_red_func = CANLED_OFF
No documentation found
const CANLED_2FLASH = 0x28
No documentation found
const CANLED_FLASH = 8
No documentation found
const CANLED_RED_ON = 2
No documentation found
const CANLED_3FLASH = 0x38
No documentation found
const CANLED_GREEN_ON = 1
No documentation found
const CANLED_4FLASH = 0x48
No documentation found
const CANLED_BLINK = 4
No documentation found
can_red_2flash()
red led: 2 200ms flashes
can_set_leds(byte in x)
Internal routine to control the bicolor led I/O pin. four leds, all connected in series between +5V and GND. PIC pin is tied to the middle, via 150 Ohm resistor. at 1.7V Vf, they will not light up (both are off) so HIGH will light both lower green LEDs LOW will light both higher RED leds pin_direction = input will light no LEDs.
can_green_on()
green led: on steady
can_led_delay100ms(word in n)
Delays for n * 100 mSec, while maintaining CAN leds
can_led_poll()
implements blinking of CAN leds. call this routine somewhere in your main loop. can led blink states are typically 200ms each, so try to call more often than 200ms.
can_red_4flash()
red led: 4 200ms flashes
can_red_off()
red led: off
can_red_1flash()
red led: 1 200ms flash
can_green_3flash()
green led: 3 200ms flashes
can_green_1flash()
green led: 1 200ms flash
can_green_2flash()
green led: 2 200ms flashes
can_green_blink()
green led: blink 200ms off, 200ms on
can_red_on()
red led: on steady
can_red_blink()
red led: blink 200ms on, 200ms off
can_green_off()
green led: off
can_red_3flash()
red led: 3 200ms flashes
18f4585 | 18f4585_canopen_blink.jal |
Author | William Welch Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | 2.4 |
The early 18C/F family had an internal CAN controller that was very similar to the MCP2515. More recent devices have an ECAN controller which has many enhanced features, but defaults on power-up to a 'legacy' mode.
No dependency found
can_set_rxb1_filter5(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
can_encode_std_id(dword in out can_id)
can_encode_rtr_id(dword in out can_id)
can_encode_ext_id(dword in out can_id)
can_set_rxb1_filter3(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
can_set_rxb0_filter0(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
can_reset()
can_set_rxb0_filter1(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
can_set_rxb0_mask(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
can_set_config(byte in p1, byte in p2, byte in p3)
can_set_rxb1_filter4(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
can_set_rxb1_mask(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
can_set_rxb1_filter2(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
can_send(byte in buf_no, dword in can_id, byte in buf[8], byte in len) return bit
can_is_ext_id(dword in can_id) return bit
can_is_rtr_id(dword in can_id) return bit
can_is_error_id(dword in can_id) return bit
can_is_std_id(dword in can_id) return bit
can_receive(byte in buf_no, dword out can_id, byte out buf[8], byte out len) return bit
can_set_rxb1_filter5(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
set RXB1 acceptance filter #5
can_encode_std_id(dword in out can_id)
No documentation found
can_encode_rtr_id(dword in out can_id)
No documentation found
can_encode_ext_id(dword in out can_id)
No documentation found
can_set_rxb1_filter3(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
set RXB1 acceptance filter #3
can_set_rxb0_filter0(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
set RXB0 acceptance filter #0
can_reset()
No documentation found
can_set_rxb0_filter1(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
set RXB0 acceptance filter #1
can_set_rxb0_mask(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
set RX acceptance mask for buffer RXB0 N.B. calling with 0,0,0,0 will pass all messages
can_set_config(byte in p1, byte in p2, byte in p3)
set bit-rate and related can bus configuration. see datasheet for details. N.B. The chip must already be in 'configuration mode'.
can_set_rxb1_filter4(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
set RXB1 acceptance filter #4
can_set_rxb1_mask(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
set RX acceptance mask for buffer RXB1 N.B. calling with 0,0,0,0 will pass all messages
can_set_rxb1_filter2(byte in sidh, byte in sidl, byte in eidh, byte in eidl)
set RXB1 acceptance filter #2
can_send(byte in buf_no, dword in can_id, byte in buf[8], byte in len) return bit
send CAN frame Non-blocking -- function returns immediately if buffer is busy (in-use) FIXME. this is ugly code
can_is_ext_id(dword in can_id) return bit
No documentation found
can_is_rtr_id(dword in can_id) return bit
No documentation found
can_is_error_id(dword in can_id) return bit
FIXME: will we ever need this?
can_is_std_id(dword in can_id) return bit
No documentation found
can_receive(byte in buf_no, dword out can_id, byte out buf[8], byte out len) return bit
receive CAN frame, sets can_id flag bits as to standard/extended, error, and remote. Non-blocking -- function returns immediately if no message is available. FIXME. this is ugly code
18f2585 | 18f2585_canid4_monitor.jal |
18f2585 | 18f2585_canid4_serial_adapter.jal |
18f2585 | 18f2585_can_serial_adapter.jal |
18f2585 | 18f2585_can_monitor.jal |
18f2585 | 18f2585_can_serial_hw.jal |
18f4585 | 18f4585_canid4_monitor.jal |
Author | William Welch Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | 2.4m |
The MCP2515 is an external CAN controller with Slave SPI interface. The controller has 3 transmit buffers and 2 receive buffers.
No dependency found
const CAN_TX1IF = 0x08
const CAN_TXB1D2 = 0x48
const CAN_CLKOUT_PS8 = 0x03
const CAN_CLKOUT_PS4 = 0x02
const CAN_TXB2D7 = 0x5D
const CAN_RXB1D1 = 0x77
const CAN_RXB0D6 = 0x6C
const CAN_RXM1SIDL = 0x25
const CAN_LOAD_TX0 = 0x40
const CAN_RXF5EID0 = 0x1B
const CAN_RXB0DLC = 0x65
const CAN_RXB1SIDH = 0x71
const CAN_TXB1D3 = 0x49
const CAN_SJW1 = 0x00
const CAN_RXB0SIDL = 0x62
const CAN_MODE_SLEEP = 0x20
const CAN_TXB2D0 = 0x56
const CAN_SOF_ENABLE = 0x80
const CAN_CLKOUT_DISABLE = 0x00
const CAN_TXB0SIDH = 0x31
const CAN_TXB2DLC = 0x55
const CAN_RXB1EID0 = 0x74
const CAN_TXB0D1 = 0x37
const CAN_RXF2SIDL = 0x09
const CAN_RXM1EID8 = 0x26
const CAN_ERRIE = 0x20
const CAN_SJW2 = 0x40
const CAN_TX0IF = 0x04
const CAN_MODE_CONFIG = 0x80
const CAN_CNF3 = 0x28
const CAN_TXB0EID0 = 0x34
const CAN_TXB0D7 = 0x3D
const CAN_RXB0EID8 = 0x63
const CAN_RXF5SIDL = 0x19
const CANINTE = 0x2B
const CAN_TXB1CTRL = 0x40
const CAN_ERRIF = 0x20
const CAN_WRITE_CMD = 0x02
const CAN_RX1IE = 0x02
const CAN_TXB1SIDL = 0x42
const CAN_MODE_MASK = 0xE0
const CAN_RXB0D7 = 0x6D
const CAN_RXF1EID8 = 0x06
const CAN_READ_RX1_DATA = 0x96
const CAN_TXB2EID0 = 0x54
const CAN_RXB1D5 = 0x7B
const CAN_RTS_TX2 = 0x84
const CANINTF = 0x2C
const CAN_TXB2SIDH = 0x51
const CANSTAT = 0x0E
const CAN_TXB1D7 = 0x4D
const CAN_TXB2SIDL = 0x52
const CAN_TXB2D6 = 0x5C
const CAN_RX_STATUS_CMD = 0xB0
const CAN_RXB1D2 = 0x78
const CAN_SJW4 = 0xC0
const CAN_MERRF = 0x80
const CAN_EFLG = 0x2D
const CAN_TXB0D4 = 0x3A
const CAN_TXB2D3 = 0x59
const CAN_TEC = 0x1C
const CAN_RXF3EID0 = 0x13
const CAN_RXM0EID0 = 0x23
const CAN_RXB1SIDL = 0x72
const CAN_RXB0D0 = 0x66
const CAN_TXB1D5 = 0x4B
const CAN_TXB2D1 = 0x57
const CAN_RXM1EID0 = 0x27
const CAN_RXB0D5 = 0x6B
const CAN_LOAD_TX2 = 0x44
const CAN_TXB1SIDH = 0x41
const CAN_RXF1SIDL = 0x05
const CAN_WAKFIL_ENABLE = 0x40
const CAN_RXF2EID0 = 0x0B
const CAN_RXM0SIDL = 0x21
const CAN_RX1IF = 0x02
const CAN_TXB1EID8 = 0x43
const CAN_RXM0EID8 = 0x22
const CAN_TXB0D3 = 0x39
const CAN_SJW3 = 0x80
const CAN_RXF4EID0 = 0x17
const CAN_CNF1 = 0x2A
const CAN_MODE_ONESHOT = 0x08
const CAN_RXB0D2 = 0x68
const CAN_RXF3EID8 = 0x12
const CAN_RXB1D7 = 0x7D
const CAN_TXB1D4 = 0x4A
const CAN_RXB1D0 = 0x76
const CAN_RXF4SIDL = 0x15
const CAN_TXB1D0 = 0x46
const CAN_RTS_ALL = 0x87
const CAN_TXB0SIDL = 0x32
const CAN_RX0IE = 0x01
const CAN_CLKOUT_ENABLE = 0x04
const CAN_TXB0DLC = 0x35
const CAN_RXB1EID8 = 0x73
const CAN_RXB1DLC = 0x75
const CAN_RXF4EID8 = 0x16
const CAN_TXB0D0 = 0x36
const CAN_REC = 0x1D
const CAN_SAMPLE_3X = 0x40
const CAN_WAKIE = 0x40
const CAN_RXB1CTRL = 0x70
const CAN_CNF2 = 0x29
const CAN_RXB0CTRL = 0x60
const CAN_TX0IE = 0x04
const CAN_WAKIF = 0x40
const CAN_TXB1D6 = 0x4C
const CAN_RXB1D3 = 0x79
const CAN_TX1IE = 0x08
const CAN_BTLMODE = 0x80
const CAN_SAMPLE_1X = 0x00
const CAN_SOF_DISABLE = 0x00
const CAN_TXB0D6 = 0x3C
const CAN_TX2IF = 0x10
const CAN_RXB1D4 = 0x7A
const CAN_RXF1EID0 = 0x07
const CAN_RXF0EID0 = 0x03
const CAN_RXF5SIDH = 0x18
const CAN_RXF3SIDH = 0x10
const CAN_RXF0EID8 = 0x02
const CAN_CLKOUT_PS1 = 0x00
const CAN_RXF3SIDL = 0x11
const CAN_RXB0D3 = 0x69
const CAN_CLKOUT_PS2 = 0x01
const CAN_ABORT_TX = 0x10
const CAN_RXM0SIDH = 0x20
const CAN_READ_CMD = 0x03
const CAN_READ_STATUS_CMD = 0xA0
const CAN_TXB0EID8 = 0x33
const CAN_TXB1D1 = 0x47
const CAN_RXB1D6 = 0x7C
const CAN_TXB2D5 = 0x5B
const CAN_LOAD_TX1 = 0x42
const CAN_RXF1SIDH = 0x04
const CAN_TXB1DLC = 0x45
const CAN_RXM1SIDH = 0x24
const CAN_READ_RX0_DATA = 0x92
const CAN_RXF5EID8 = 0x1A
const CAN_RXB0SIDH = 0x61
const CAN_TXB2EID8 = 0x53
const CAN_TXB1EID0 = 0x44
const CANCTRL = 0x0F
const CAN_TXB2CTRL = 0x50
const CAN_BITMOD = 0x05
const CAN_RTS_TX1 = 0x82
const CAN_TXB2D2 = 0x58
const CAN_RXB0D1 = 0x67
const CAN_RXF0SIDL = 0x01
const CAN_RXF0SIDH = 0x00
const CAN_RXF2SIDH = 0x08
const CAN_TXB0D2 = 0x38
const CAN_RX0IF = 0x01
const CAN_MERRE = 0x80
const CAN_MODE_LOOPBACK = 0x40
const CAN_TXB2D4 = 0x5A
const CAN_TXB0D5 = 0x3B
const CAN_RXB0EID0 = 0x64
const CAN_MODE_NORMAL = 0x00
const CAN_WAKFIL_DISABLE = 0x00
const CAN_RXB0D4 = 0x6A
const CAN_TXB0CTRL = 0x30
const CAN_RXF4SIDH = 0x14
const CAN_TX2IE = 0x10
const CAN_RESET_CMD = 0xC0
const CAN_MODE_LISTENONLY = 0x60
const CAN_MODE_POWERUP = 0xE0
const CAN_RTS_TX0 = 0x81
const CAN_RXF2EID8 = 0x0A
can_encode_std_id(dword in out can_id)
can_set_rxb1_filter3(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_encode_ext_id(dword in out can_id)
can_encode_rtr_id(dword in out can_id)
can_set_rxb0_filter0(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_write(byte in addr, byte in data)
can_set_rxb1_filter4(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_set_rxb0_filter1(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_set_rxb1_filter2(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_set_rxb1_filter5(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_set_rxb1_mask(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_reset()
can_set_config(byte in p1, byte in p2, byte in p3)
can_set_rxb0_mask(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_send(byte in buf_no, dword in can_id, byte in buf[8], byte in len) return bit
can_is_ext_id(dword in can_id) return bit
can_is_rtr_id(dword in can_id) return bit
can_rx_status() return byte
can_read_status() return byte
can_is_error_id(dword in can_id) return bit
can_read(byte in addr) return byte
can_is_std_id(dword in can_id) return bit
can_receive(byte in buf_no, dword out can_id, byte out buf[8], byte out len) return bit
const CAN_TX1IF = 0x08
No documentation found
const CAN_TXB1D2 = 0x48
No documentation found
const CAN_CLKOUT_PS8 = 0x03
No documentation found
const CAN_CLKOUT_PS4 = 0x02
No documentation found
const CAN_TXB2D7 = 0x5D
No documentation found
const CAN_RXB1D1 = 0x77
No documentation found
const CAN_RXB0D6 = 0x6C
No documentation found
const CAN_RXM1SIDL = 0x25
No documentation found
const CAN_LOAD_TX0 = 0x40
No documentation found
const CAN_RXF5EID0 = 0x1B
No documentation found
const CAN_RXB0DLC = 0x65
No documentation found
const CAN_RXB1SIDH = 0x71
No documentation found
const CAN_TXB1D3 = 0x49
No documentation found
const CAN_SJW1 = 0x00
No documentation found
const CAN_RXB0SIDL = 0x62
No documentation found
const CAN_MODE_SLEEP = 0x20
No documentation found
const CAN_TXB2D0 = 0x56
No documentation found
const CAN_SOF_ENABLE = 0x80
No documentation found
const CAN_CLKOUT_DISABLE = 0x00
No documentation found
const CAN_TXB0SIDH = 0x31
No documentation found
const CAN_TXB2DLC = 0x55
No documentation found
const CAN_RXB1EID0 = 0x74
No documentation found
const CAN_TXB0D1 = 0x37
No documentation found
const CAN_RXF2SIDL = 0x09
No documentation found
const CAN_RXM1EID8 = 0x26
No documentation found
const CAN_ERRIE = 0x20
No documentation found
const CAN_SJW2 = 0x40
No documentation found
const CAN_TX0IF = 0x04
No documentation found
const CAN_MODE_CONFIG = 0x80
No documentation found
const CAN_CNF3 = 0x28
CNF3 and fields
const CAN_TXB0EID0 = 0x34
No documentation found
const CAN_TXB0D7 = 0x3D
No documentation found
const CAN_RXB0EID8 = 0x63
No documentation found
const CAN_RXF5SIDL = 0x19
No documentation found
const CANINTE = 0x2B
CANINTE register and fields
const CAN_TXB1CTRL = 0x40
No documentation found
const CAN_ERRIF = 0x20
No documentation found
const CAN_WRITE_CMD = 0x02
MCP2515 Instructions ( SPI interface )
const CAN_RX1IE = 0x02
No documentation found
const CAN_TXB1SIDL = 0x42
No documentation found
const CAN_MODE_MASK = 0xE0
No documentation found
const CAN_RXB0D7 = 0x6D
No documentation found
const CAN_RXF1EID8 = 0x06
No documentation found
const CAN_READ_RX1_DATA = 0x96
No documentation found
const CAN_TXB2EID0 = 0x54
No documentation found
const CAN_RXB1D5 = 0x7B
No documentation found
const CAN_RTS_TX2 = 0x84
No documentation found
const CANINTF = 0x2C
CANINTF register and fields
const CAN_TXB2SIDH = 0x51
No documentation found
const CANSTAT = 0x0E
other misc registers
const CAN_TXB1D7 = 0x4D
No documentation found
const CAN_TXB2SIDL = 0x52
No documentation found
const CAN_TXB2D6 = 0x5C
No documentation found
const CAN_RX_STATUS_CMD = 0xB0
No documentation found
const CAN_RXB1D2 = 0x78
No documentation found
const CAN_SJW4 = 0xC0
No documentation found
const CAN_MERRF = 0x80
No documentation found
const CAN_EFLG = 0x2D
No documentation found
const CAN_TXB0D4 = 0x3A
No documentation found
const CAN_TXB2D3 = 0x59
No documentation found
const CAN_TEC = 0x1C
No documentation found
const CAN_RXF3EID0 = 0x13
No documentation found
const CAN_RXM0EID0 = 0x23
No documentation found
const CAN_RXB1SIDL = 0x72
No documentation found
const CAN_RXB0D0 = 0x66
No documentation found
const CAN_TXB1D5 = 0x4B
No documentation found
const CAN_TXB2D1 = 0x57
No documentation found
const CAN_RXM1EID0 = 0x27
No documentation found
const CAN_RXB0D5 = 0x6B
No documentation found
const CAN_LOAD_TX2 = 0x44
No documentation found
const CAN_TXB1SIDH = 0x41
No documentation found
const CAN_RXF1SIDL = 0x05
No documentation found
const CAN_WAKFIL_ENABLE = 0x40
No documentation found
const CAN_RXF2EID0 = 0x0B
No documentation found
const CAN_RXM0SIDL = 0x21
No documentation found
const CAN_RX1IF = 0x02
No documentation found
const CAN_TXB1EID8 = 0x43
No documentation found
const CAN_RXM0EID8 = 0x22
No documentation found
const CAN_TXB0D3 = 0x39
No documentation found
const CAN_SJW3 = 0x80
No documentation found
const CAN_RXF4EID0 = 0x17
No documentation found
const CAN_CNF1 = 0x2A
Bit-rate and related registers and fields. Big topic. See datasheet. CNF1 register and fields
const CAN_MODE_ONESHOT = 0x08
No documentation found
const CAN_RXB0D2 = 0x68
No documentation found
const CAN_RXF3EID8 = 0x12
No documentation found
const CAN_RXB1D7 = 0x7D
No documentation found
const CAN_TXB1D4 = 0x4A
No documentation found
const CAN_RXB1D0 = 0x76
No documentation found
const CAN_RXF4SIDL = 0x15
No documentation found
const CAN_TXB1D0 = 0x46
No documentation found
const CAN_RTS_ALL = 0x87
No documentation found
const CAN_TXB0SIDL = 0x32
No documentation found
const CAN_RX0IE = 0x01
No documentation found
const CAN_CLKOUT_ENABLE = 0x04
No documentation found
const CAN_TXB0DLC = 0x35
No documentation found
const CAN_RXB1EID8 = 0x73
No documentation found
const CAN_RXB1DLC = 0x75
No documentation found
const CAN_RXF4EID8 = 0x16
No documentation found
const CAN_TXB0D0 = 0x36
No documentation found
const CAN_REC = 0x1D
No documentation found
const CAN_SAMPLE_3X = 0x40
No documentation found
const CAN_WAKIE = 0x40
No documentation found
const CAN_RXB1CTRL = 0x70
No documentation found
const CAN_CNF2 = 0x29
CNF2 register and fields
const CAN_RXB0CTRL = 0x60
Each receive buffer has a control register, header registers, length register and (up to ) eight bytes of payload.
const CAN_TX0IE = 0x04
No documentation found
const CAN_WAKIF = 0x40
No documentation found
const CAN_TXB1D6 = 0x4C
No documentation found
const CAN_RXB1D3 = 0x79
No documentation found
const CAN_TX1IE = 0x08
No documentation found
const CAN_BTLMODE = 0x80
No documentation found
const CAN_SAMPLE_1X = 0x00
No documentation found
const CAN_SOF_DISABLE = 0x00
No documentation found
const CAN_TXB0D6 = 0x3C
No documentation found
const CAN_TX2IF = 0x10
No documentation found
const CAN_RXB1D4 = 0x7A
No documentation found
const CAN_RXF1EID0 = 0x07
No documentation found
const CAN_RXF0EID0 = 0x03
No documentation found
const CAN_RXF5SIDH = 0x18
RXB1 filter #5
const CAN_RXF3SIDH = 0x10
RXB1 filter #3
const CAN_RXF0EID8 = 0x02
No documentation found
const CAN_CLKOUT_PS1 = 0x00
No documentation found
const CAN_RXF3SIDL = 0x11
No documentation found
const CAN_RXB0D3 = 0x69
No documentation found
const CAN_CLKOUT_PS2 = 0x01
No documentation found
const CAN_ABORT_TX = 0x10
No documentation found
const CAN_RXM0SIDH = 0x20
RXB0 mask
const CAN_READ_CMD = 0x03
No documentation found
const CAN_READ_STATUS_CMD = 0xA0
No documentation found
const CAN_TXB0EID8 = 0x33
No documentation found
const CAN_TXB1D1 = 0x47
No documentation found
const CAN_RXB1D6 = 0x7C
No documentation found
const CAN_TXB2D5 = 0x5B
No documentation found
const CAN_LOAD_TX1 = 0x42
No documentation found
const CAN_RXF1SIDH = 0x04
RXB0 filter #1
const CAN_TXB1DLC = 0x45
No documentation found
const CAN_RXM1SIDH = 0x24
RXB1 mask
const CAN_READ_RX0_DATA = 0x92
No documentation found
const CAN_RXF5EID8 = 0x1A
No documentation found
const CAN_RXB0SIDH = 0x61
No documentation found
const CAN_TXB2EID8 = 0x53
No documentation found
const CAN_TXB1EID0 = 0x44
No documentation found
const CANCTRL = 0x0F
CANCTRL register and fields
const CAN_TXB2CTRL = 0x50
No documentation found
const CAN_BITMOD = 0x05
No documentation found
const CAN_RTS_TX1 = 0x82
No documentation found
const CAN_TXB2D2 = 0x58
No documentation found
const CAN_RXB0D1 = 0x67
No documentation found
const CAN_RXF0SIDL = 0x01
No documentation found
const CAN_RXF0SIDH = 0x00
RXB0 filter #0
const CAN_RXF2SIDH = 0x08
RXB1 filter #2
const CAN_TXB0D2 = 0x38
No documentation found
const CAN_RX0IF = 0x01
No documentation found
const CAN_MERRE = 0x80
No documentation found
const CAN_MODE_LOOPBACK = 0x40
No documentation found
const CAN_TXB2D4 = 0x5A
No documentation found
const CAN_TXB0D5 = 0x3B
No documentation found
const CAN_RXB0EID0 = 0x64
No documentation found
const CAN_MODE_NORMAL = 0x00
No documentation found
const CAN_WAKFIL_DISABLE = 0x00
No documentation found
const CAN_RXB0D4 = 0x6A
No documentation found
const CAN_TXB0CTRL = 0x30
Three transmit buffers. Each transmit buffer has a control register, header registers, length register and (up to ) eight bytes of payload.
const CAN_RXF4SIDH = 0x14
RXB1 filter #4
const CAN_TX2IE = 0x10
No documentation found
const CAN_RESET_CMD = 0xC0
No documentation found
const CAN_MODE_LISTENONLY = 0x60
No documentation found
const CAN_MODE_POWERUP = 0xE0
No documentation found
const CAN_RTS_TX0 = 0x81
No documentation found
const CAN_RXF2EID8 = 0x0A
No documentation found
can_encode_std_id(dword in out can_id)
No documentation found
can_set_rxb1_filter3(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RXB1 acceptance filter #3
can_encode_ext_id(dword in out can_id)
No documentation found
can_encode_rtr_id(dword in out can_id)
No documentation found
can_set_rxb0_filter0(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RXB0 acceptance filter #0
can_write(byte in addr, byte in data)
mcp2515 write instruction (single byte) writes the value to the specified register
can_set_rxb1_filter4(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RXB1 acceptance filter #4
can_set_rxb0_filter1(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RXB0 acceptance filter #1
can_set_rxb1_filter2(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RXB1 acceptance filter #2
can_set_rxb1_filter5(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RXB1 acceptance filter #5
can_set_rxb1_mask(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RX acceptance mask for buffer RXB1 N.B. calling with 0,0,0,0 will pass all messages
can_reset()
mcp2515 Reset instruction. Puts the mcp2515 in Configuration Mode.
can_set_config(byte in p1, byte in p2, byte in p3)
set bit-rate and related can bus configuration. see datasheet for details. N.B. The chip must already be in 'configuration mode'.
can_set_rxb0_mask(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RX acceptance mask for buffer RXB0 N.B. calling with 0,0,0,0 will pass all messages
can_send(byte in buf_no, dword in can_id, byte in buf[8], byte in len) return bit
send CAN frame Non-blocking -- function returns immediately if buffer is busy (in-use) FIXME. this is ugly code
can_is_ext_id(dword in can_id) return bit
No documentation found
can_is_rtr_id(dword in can_id) return bit
No documentation found
can_rx_status() return byte
mcp2515 RX status instruction
can_read_status() return byte
mcp2515 read status instruction
can_is_error_id(dword in can_id) return bit
FIXME: will we ever need this?
can_read(byte in addr) return byte
mcp2515 read instruction (single byte) returns the current value of the specified register
can_is_std_id(dword in can_id) return bit
No documentation found
can_receive(byte in buf_no, dword out can_id, byte out buf[8], byte out len) return bit
receive CAN frame, sets can_id flag bits as to standard/extended, error, and remote. Non-blocking -- function returns immediately if no message is available. FIXME. this is ugly code
16f819 | 16f819_mcp2515_can_monitor.jal |
16f819 | 16f819_canopen_mcp2515_txhb.jal |
16f819 | 16f819_mcp2515_canid4_monitor.jal |
Author | William Welch Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | 2.4 |
a small CAN library compatible with CANopen
Cia DS 301 version 4.02
No dependency found
co_send(dword in cob_id, byte in data[8], byte in len)
co_decode_cob_id(dword in cob_id, byte out func, byte out node_id)
co_receive(dword out cob_id, byte out data[8], byte out len)
co_encode_cob_id(byte in func, byte in node_id, dword out cob_id)
co_send(dword in cob_id, byte in data[8], byte in len)
send standard 11-bit CANopen message FIXME: we are only using one of the TX buffers (3 are available) FIXME: handle timeout
co_decode_cob_id(dword in cob_id, byte out func, byte out node_id)
extract function code and node_id from 11-bit cob_id
co_receive(dword out cob_id, byte out data[8], byte out len)
receive standard 11-bit CANopen message FIXME: we are assuming rollover is set up from RXB0 to RXB1 FIXME: handle timeout
co_encode_cob_id(byte in func, byte in node_id, dword out cob_id)
format the COB-ID, which is a 'standard' 11-bit CAN identifier. the function code is upper 4 bits, the node_id is lower 7 bits.
16f819 | 16f819_canopen_mcp2515_txhb.jal |
18f2585 | 18f2585_can_monitor.jal |
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4k |
Library for managing characters.
No dependency found
char_is_letter(byte in char) return bit
char_is_printable(byte in char) return bit
char_is_digit(byte in char) return bit
char_is_lower(byte in char) return bit
char_is_upper(byte in char) return bit
char_compare(byte in char1, byte in char2) return bit
char_lower(byte in out char)
No documentation found
char_int_to_ascii(byte in out num)
No documentation found
char_upper(byte in out char)
No documentation found
char_is_letter(byte in char) return bit
No documentation found
char_is_printable(byte in char) return bit
No documentation found
char_is_digit(byte in char) return bit
No documentation found
char_is_lower(byte in char) return bit
No documentation found
char_is_upper(byte in char) return bit
No documentation found
char_compare(byte in char1, byte in char2) return bit
No documentation found
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4l |
This library calculates checksums for data error detection.
http://www.faqs.org/rfcs/rfc1071.html
No dependency found
checksum_16_byte_calc(byte in buff[], word in start, word in size) return word
checksum_16_byte_verify(byte in buff[], word in start, word in size) return bit
checksum_16_byte_calc(byte in buff[], word in start, word in size) return word
No documentation found
checksum_16_byte_verify(byte in buff[], word in start, word in size) return bit
No documentation found
Author | Eur van Andel, eur@fiwihex.nl Copyright (c) 2008 |
Adapted-by | Albert Faber |
Compiler | =2.4m |
this library communicates with the T6603 GE/Telaire CO2 sensor. This sensor uses the Telaire Tsunami-Lite Commnications Protocol (no kidding), which is a definition with zero hits on Google. available functions are: get_status() return byte get_co2_ppm() return word -- CO2 concentration in ppm get_serial_numer() return string[15] get_elevation_m() return word -- in meters above sea level
The brochure is here: www.gesensing.com/downloads/datasheets/920-419A_LR.pdf Some clippings from the protocol document: ------------ START OF PROTOCOL DOCUMENT CLIPPINGS ---------------------
No dependency found
var word co2_global
const CMD_UPDATE = 0x03
const ELEVATION = 0x0F
const SERIAL = 0x01
const BRDCST = 0xFE
const CMD_READ = 0x02
const CO2_PPM = 0x03
const CMD_STATUS = 0xB6
const FLAG = 0xFF
var word co2_global
global CO2 value, keeps value when garbage reply
const CMD_UPDATE = 0x03
No documentation found
const ELEVATION = 0x0F
No documentation found
const SERIAL = 0x01
No documentation found
const BRDCST = 0xFE
No documentation found
const CMD_READ = 0x02
No documentation found
const CO2_PPM = 0x03
No documentation found
const CMD_STATUS = 0xB6
No documentation found
const FLAG = 0xFF
No documentation found
set_co2_elevation_m(word in meters)
should set elevation in meters above sea level, not implemented yet
get_co2_serial_number(byte out str[8])
returns 8 byte ASCII string, which should be the same as the number on the sticker
get_co2_elevation_m() return word
returns programmed elevation above sea level in meters this elevation is uses to calculate CO2 concentration correctly
get_co2_ppm() return word
returns a word with CO2 concentration in ppm note: if sensor is busy measuring the CO2 values, it will give garbage reply reply is checked for garbage and if so, *PREVIOUS* ppm value is returned
get_co2_status() return byte
returns status byte. bit_0 = error, bit_1 = warmup, bit_2 = calibration, bit_3 = idle
16f876a | 16f876a_t6603.jal |
16f877a | 16f877a_co2_t6603.jal |
Author | Rob Hamerling, Copyright (c) 2010, all rights reserved. |
Adapted-by | |
Compiler | 2.4n |
Common include file for Jallib libraries
No dependency found
const ADC_V9 = 0x_ADC_9
const ADC_V11 = 0x_ADC_11
const byte ADC_VREF_POS_NEG = 2
const ADC_V2 = 0x_ADC_2
const ADC_V13_2 = 0x_ADC_13_2
const NETWORK_SLIP = 0
const bit OUTPUT = FALSE
const ADC_V6 = 0x_ADC_6
const FONT_BOTTOM_RIGHT_VERTICAL = 5
const FONT_BOTTOM_LEFT_HORIZONTAL = 6
const ADC_V4 = 0x_ADC_4
const bit DISABLED = FALSE
const byte STOPWATCH_MS = 3
const byte ADC_VREF_POS = 1
const FONT_BOTTOM_LEFT_VERTICAL = 7
const bit HIGH = TRUE
const ADC_V5 = 0x_ADC_5
const ADC_V10 = 0x_ADC_10
const FONT_TOP_LEFT_HORIZONTAL = 2
const bit FALSE = 0
const PPS_0 = 0
const byte STOPWATCH_S = 4
const ADC_V1 = 0x_ADC_1
const byte STOPWATCH_US = 2
const byte ADC_VREF_NEG = 3
const ADC_V13 = 0x_ADC_13
const bit TRUE = 1
const bit OFF = FALSE
const ADC_V3 = 0x_ADC_3
const ADC_V13_1 = 0x_ADC_13_1
const NETWORK_ETHERNET = 1
const PPS_2 = 2
const ADC_V7_1 = 0x_ADC_7_1
const FONT_TOP_LEFT_VERTICAL = 3
const FONT_TOP_RIGHT_VERTICAL = 1
const bit ON = TRUE
const byte ADC_NO_EXT_VREF = 0
const ADC_V11_1 = 0x_ADC_11_1
const ADC_V7 = 0x_ADC_7
const byte ALL_OUTPUT = 0b_0000_0000
const NETWORK_ENC28J60 = 0
const byte ALL_INPUT = 0b_1111_1111
const byte STOPWATCH_NS = 1
const FONT_TOP_RIGHT_HORIZONTAL = 0
const bit ENABLED = TRUE
const ADC_V0 = 0x_ADC_0
const PPS_1 = 1
const bit INPUT = TRUE
const bit LOW = FALSE
const ADC_V8 = 0x_ADC_8
const ADC_V12 = 0x_ADC_12
const FONT_BOTTOM_RIGHT_HORIZONTAL = 4
const ADC_V9 = 0x_ADC_9
No documentation found
const ADC_V11 = 0x_ADC_11
No documentation found
const byte ADC_VREF_POS_NEG = 2
No documentation found
const ADC_V2 = 0x_ADC_2
No documentation found
const ADC_V13_2 = 0x_ADC_13_2
No documentation found
const NETWORK_SLIP = 0
network link layer type
const bit OUTPUT = FALSE
No documentation found
const ADC_V6 = 0x_ADC_6
No documentation found
const FONT_BOTTOM_RIGHT_VERTICAL = 5
No documentation found
const FONT_BOTTOM_LEFT_HORIZONTAL = 6
No documentation found
const ADC_V4 = 0x_ADC_4
No documentation found
const bit DISABLED = FALSE
No documentation found
const byte STOPWATCH_MS = 3
No documentation found
const byte ADC_VREF_POS = 1
No documentation found
const FONT_BOTTOM_LEFT_VERTICAL = 7
No documentation found
const bit HIGH = TRUE
No documentation found
const ADC_V5 = 0x_ADC_5
No documentation found
const ADC_V10 = 0x_ADC_10
No documentation found
const FONT_TOP_LEFT_HORIZONTAL = 2
No documentation found
const bit FALSE = 0
No documentation found
const PPS_0 = 0
no Peripheral Pin Selection!
const byte STOPWATCH_S = 4
No documentation found
const ADC_V1 = 0x_ADC_1
No documentation found
const byte STOPWATCH_US = 2
No documentation found
const byte ADC_VREF_NEG = 3
No documentation found
const ADC_V13 = 0x_ADC_13
No documentation found
const bit TRUE = 1
No documentation found
const bit OFF = FALSE
No documentation found
const ADC_V3 = 0x_ADC_3
No documentation found
const ADC_V13_1 = 0x_ADC_13_1
No documentation found
const NETWORK_ETHERNET = 1
No documentation found
const PPS_2 = 2
group # 2
const ADC_V7_1 = 0x_ADC_7_1
No documentation found
const FONT_TOP_LEFT_VERTICAL = 3
No documentation found
const FONT_TOP_RIGHT_VERTICAL = 1
No documentation found
const bit ON = TRUE
No documentation found
const byte ADC_NO_EXT_VREF = 0
No documentation found
const ADC_V11_1 = 0x_ADC_11_1
No documentation found
const ADC_V7 = 0x_ADC_7
No documentation found
const byte ALL_OUTPUT = 0b_0000_0000
No documentation found
const NETWORK_ENC28J60 = 0
supported link layer devices
const byte ALL_INPUT = 0b_1111_1111
No documentation found
const byte STOPWATCH_NS = 1
No documentation found
const FONT_TOP_RIGHT_HORIZONTAL = 0
No documentation found
const bit ENABLED = TRUE
No documentation found
const ADC_V0 = 0x_ADC_0
No documentation found
const PPS_1 = 1
group # 1
const bit INPUT = TRUE
No documentation found
const bit LOW = FALSE
No documentation found
const ADC_V8 = 0x_ADC_8
No documentation found
const ADC_V12 = 0x_ADC_12
No documentation found
const FONT_BOTTOM_RIGHT_HORIZONTAL = 4
No documentation found
Author | Tijs van Roon@RedSam, Copyright (c) 2010, all rights reserved. |
Adapted-by | |
Compiler | >=2.4m |
Analog Devices AD9833 Direct-Digital-Synthesis (DDS) chip library. The library assumes that the AD9833 chip is clocked 25Mhz (MCLK). If not, read the last section to know how to change the constants to your needs. The library is probably a very good start for other Analog DDS chips as well since all work from the same principal. Setup: Assure that you are using a 25 Mhz oscillator on the dds chip. Otherwise change the constant. See below (in the source) on how to do this.
No dependency found
const _dds_control_sleep = 0b_0000_0000_1100_0000
const _dds_control_reset = 0b_0000_0001_0000_0000
const dword _dds_const_int = 10
const dword _dds_const_dec = 12_371_825
const _dds_control_base = 0b_0010_0000_0000_1000
const _dds_control_triangle = 0b_0000_0000_0000_0010
const _dds_control_sine = 0b_0000_0000_0000_0000
const _dds_control_square = 0b_0000_0000_0110_0000
const _dds_control_sleep = 0b_0000_0000_1100_0000
Sleep on, DAC off
const _dds_control_reset = 0b_0000_0001_0000_0000
reset
const dword _dds_const_int = 10
No documentation found
const dword _dds_const_dec = 12_371_825
No documentation found
const _dds_control_base = 0b_0010_0000_0000_1000
Info on the Control Word: --------------------------------------------------- bit we use descr 15/14 xx register select: 00 = control, 01 = freq0, 10 = freq1, 11 = phase0&1 (use bit 13 13 1 B28: 0 = select LSB/MSB via bit 12, 1 = write MSB&LSB in consecutive write, B28: 0 = write phase0, 1 = write phase1 12 0 HLB: select LSB/MSB: ignored in 28-bit mode 11 0 FSELECT: 0 = freq0, 1 = freq1 10 0 PSELECT: 0 = phase0, 1 = phase1 9 0 reserved 8 x RESET: 1 = reset state, 0 = no reset. 1 on init, 0 on running 7 0 SLEEP1: 0 = MCLK enabled, 1 = MCLK disabled (device freezes) 6 0 SLEEP12: 0 = DAC on, 1 = DAC disabled 5 x OPBITEN: 0 = DAC (sine/triangle), 1 = MSB (square) 4 0 reserved 3 0 DIV2: 0 = MSB/2, 1 = MSB 2 0 reserved 1 x MODE: 0 = Sine, 1 = triangle 0 0 reserved init: 0b_0010_0001_0000_1000 square:0b_0010_0000_0011_1000 triang:0b_0010_0000_0000_1010 sine: 0b_0010_0000_0000_1000 write freq0: write 0b_01mm_mmmm_mmmm CONTROL: 0b_0010_000R_SDO0_10M0
const _dds_control_triangle = 0b_0000_0000_0000_0010
DAC ON, MSB off, Mode=triangle
const _dds_control_sine = 0b_0000_0000_0000_0000
DAC ON, MSB off, Mode=sine
const _dds_control_square = 0b_0000_0000_0110_0000
DAC off, MSB on
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4n |
The debug library has all the same functions as the print library, but the user defines constants to turn on and off this library and users debug levels.
The jallib print library
var bit debug_lvl_11 at debug_bits : 11
const DEBUG_13 = 13
var bit debug_lvl_1 at debug_bits : 1
const DEBUG_14 = 14
var bit debug_lvl_9 at debug_bits : 9
var bit debug_lvl_10 at debug_bits : 10
const DEBUG_2 = 2
var bit debug_lvl_4 at debug_bits : 4
const DEBUG_0 = 0
const DEBUG_8 = 8
var bit debug_lvl_8 at debug_bits : 8
const DEBUG_7 = 7
var bit debug_lvl_2 at debug_bits : 2
var bit debug_lvl_6 at debug_bits : 6
const DEBUG_15 = 15
var bit debug_lvl_0 at debug_bits : 0
const DEBUG_1 = 1
var word debug_bits = 0
const DEBUG_10 = 10
const DEBUG_12 = 12
const DEBUG_6 = 6
var bit debug_lvl_7 at debug_bits : 7
const DEBUG_3 = 3
const DEBUG_5 = 5
var bit debug_lvl_3 at debug_bits : 3
var bit debug_lvl_5 at debug_bits : 5
var bit debug_lvl_15 at debug_bits : 15
var bit debug_lvl_14 at debug_bits : 14
var bit debug_lvl_12 at debug_bits : 12
var bit debug_lvl_13 at debug_bits : 13
const DEBUG_9 = 9
const DEBUG_11 = 11
const DEBUG_4 = 4
debug_crlf(word in debug_level)
debug_byte_hex(word in debug_level,byte in data)
debug_bit_10(word in debug_level,bit in data)
debug_word_dec(word in debug_level,word in data)
debug_byte_binary(word in debug_level,byte in data)
debug_string(word in debug_level,byte in str_in[])
debug_universal_dec(word in debug_level, dword in data, sbyte in divisor_index)
debug_byte_dec(word in debug_level,byte in data)
debug_sword_dec(word in debug_level,sword in data)
debug_sbyte_dec(word in debug_level,sbyte in data)
debug_dword_binary(word in debug_level,dword in data)
debug_sword_fp_dec(word in debug_level,sword in data)
debug_word_binary(word in debug_level,word in data)
debug_nibble_binary(word in debug_level,byte in data)
debug_dword_dec(word in debug_level,dword in data)
debug_bit_highlow(word in debug_level,bit in data)
debug_char(word in debug_level,byte in character)
debug_word_hex(word in debug_level,word in data)
debug_suniversal_dec(word in debug_level,sdword in data, sbyte in divisor_index)
debug_dword_hex(word in debug_level,dword in data)
debug_sdword_dec(word in debug_level,sdword in data)
debug_sdword_hex(word in debug_level,sdword in data)
debug_bit_truefalse(word in debug_level,bit in data)
var bit debug_lvl_11 at debug_bits : 11
No documentation found
const DEBUG_13 = 13
No documentation found
var bit debug_lvl_1 at debug_bits : 1
No documentation found
const DEBUG_14 = 14
No documentation found
var bit debug_lvl_9 at debug_bits : 9
No documentation found
var bit debug_lvl_10 at debug_bits : 10
No documentation found
const DEBUG_2 = 2
No documentation found
var bit debug_lvl_4 at debug_bits : 4
No documentation found
const DEBUG_0 = 0
you can use these instead of numbers as input level. makes it easy for you to change levels in code with your editor's "replace all"
const DEBUG_8 = 8
No documentation found
var bit debug_lvl_8 at debug_bits : 8
No documentation found
const DEBUG_7 = 7
No documentation found
var bit debug_lvl_2 at debug_bits : 2
No documentation found
var bit debug_lvl_6 at debug_bits : 6
No documentation found
const DEBUG_15 = 15
No documentation found
var bit debug_lvl_0 at debug_bits : 0
No documentation found
const DEBUG_1 = 1
No documentation found
var word debug_bits = 0
debug enable/disable bits
const DEBUG_10 = 10
No documentation found
const DEBUG_12 = 12
No documentation found
const DEBUG_6 = 6
No documentation found
var bit debug_lvl_7 at debug_bits : 7
No documentation found
const DEBUG_3 = 3
No documentation found
const DEBUG_5 = 5
No documentation found
var bit debug_lvl_3 at debug_bits : 3
No documentation found
var bit debug_lvl_5 at debug_bits : 5
No documentation found
var bit debug_lvl_15 at debug_bits : 15
No documentation found
var bit debug_lvl_14 at debug_bits : 14
No documentation found
var bit debug_lvl_12 at debug_bits : 12
No documentation found
var bit debug_lvl_13 at debug_bits : 13
No documentation found
const DEBUG_9 = 9
No documentation found
const DEBUG_11 = 11
No documentation found
const DEBUG_4 = 4
No documentation found
debug_crlf(word in debug_level)
No documentation found
debug_byte_hex(word in debug_level,byte in data)
No documentation found
debug_bit_10(word in debug_level,bit in data)
No documentation found
debug_word_dec(word in debug_level,word in data)
No documentation found
debug_byte_binary(word in debug_level,byte in data)
No documentation found
debug_string(word in debug_level,byte in str_in[])
No documentation found
debug_universal_dec(word in debug_level, dword in data, sbyte in divisor_index)
No documentation found
debug_byte_dec(word in debug_level,byte in data)
No documentation found
debug_sword_dec(word in debug_level,sword in data)
No documentation found
debug_sbyte_dec(word in debug_level,sbyte in data)
No documentation found
debug_dword_binary(word in debug_level,dword in data)
No documentation found
debug_sword_fp_dec(word in debug_level,sword in data)
No documentation found
debug_word_binary(word in debug_level,word in data)
No documentation found
debug_nibble_binary(word in debug_level,byte in data)
No documentation found
debug_dword_dec(word in debug_level,dword in data)
No documentation found
debug_bit_highlow(word in debug_level,bit in data)
No documentation found
debug_char(word in debug_level,byte in character)
No documentation found
debug_word_hex(word in debug_level,word in data)
No documentation found
debug_suniversal_dec(word in debug_level,sdword in data, sbyte in divisor_index)
No documentation found
debug_dword_hex(word in debug_level,dword in data)
No documentation found
debug_sdword_dec(word in debug_level,sdword in data)
No documentation found
debug_sdword_hex(word in debug_level,sdword in data)
No documentation found
debug_bit_truefalse(word in debug_level,bit in data)
No documentation found
18f4550 | 18f4550_debug.jal |
Author | Stef Mientki, Copyright (c) 2002..2006, all rights reserved. |
Adapted-by | Sebastien Lelong, Rob Hamerling, Joep Suijs |
Compiler | >=2.4g |
library for delays at any processor frequency. It's based on the JAL v2 compiler generator _usec_delay.
No dependency found
delay_7us()
delay_1s(word in n)
delay_3us()
delay_10us(byte in n)
delay_8us()
delay_1ms(word in n)
delay_2us()
delay_4us()
delay_1us()
delay_100ms(word in n)
delay_9us()
delay_6us()
delay_5us()
const instruction_time = 400_000_000 / target_clock
calculate instruction execution time in 10ns units
delay_7us()
fixed delay of 7 usec (no arguments)
delay_1s(word in n)
Delays for n * 1 sec
delay_3us()
fixed delay of 3 usec (no arguments)
delay_10us(byte in n)
Delays for n * 10 usec
delay_8us()
fixed delay of 8 usec (no arguments)
delay_1ms(word in n)
Delays for n * 1 msec
delay_2us()
fixed delay of 2 usec (no arguments)
delay_4us()
fixed delay of 4 usec (no arguments)
delay_1us()
fixed delay of 1 usec (no arguments)
delay_100ms(word in n)
Delays for n * 100 msec
delay_9us()
fixed delay of 9 usec (no arguments)
delay_6us()
fixed delay of 6 usec (no arguments)
delay_5us()
fixed delay of 5 usec (no arguments)
Author | Jean Marchaudon, Copyright (c) 2010..2010, all rights reserved. |
Adapted-by | And-Tech.pl, Bert van Dam, Jean Marchaudon, Olivier Seit, |
Compiler | >=2.4m |
1 wire routines for the DS18b20 temperature probe Read sensor temperature DS18b20 from a specific device using the drive's ID use _s_ procedures when there is only one device on the bus. use _m_ procedures when there is more than one device on the bus.
ds18b20 datasheet (http://datasheets.maxim-ic.com/en/ds/DS18B20.pdf)
requires 1_wire.jal
No dependency found
ds18b20_m_convert(byte in id[])
ds18b20_convert()
ds18b20_setup(sbyte in th, sbyte in tl, byte in resolution)
ds18b20_m_temp(byte in id[], sword out temperature) return bit
ds18b20_s_read_rom() return bit
ds18b20_s_temp(sword out temperature) return bit
var byte scratchpad[9]
No documentation found
ds18b20_m_convert(byte in id[])
ds18b20_m_convert - start conversion of a specific devices on the bus. Parameter: 8-byte ID of device to operate on
ds18b20_convert()
ds18b20_convert - start conversion of all devices on the bus. This is actually like an _s_ procedure. When it is executed on a bus with multiple ds18b20 devices, all will start conversion.
ds18b20_setup(sbyte in th, sbyte in tl, byte in resolution)
ds18b20_setup -- !!! UNTESTED !!! ***** YOU DON'T NEED THIS FUNCTION FOR TEMPERATURE ***** ***** READING WITH 12 BIT (DEFAULT) RESOLUTION ***** *** PLEASE REPORT IF YOU TESTED THIS FUNCTION (PARTLY OR FULL) *** resolution can be 9, 10, 11, 12 TL = minimum -55 TH = maximum 124
_ds18b20_skip_rom()
_ds18b20_skip_rom - activate all devices on the bus Note: not sure if 'all devices' means all ds18b20 devices or all one_wire devices. I guess this is beyond the scope of this library though ;)
_ds18b20_match_rom(byte in id[])
_ds18b20_match_rom - activate specified device Parameter: 8-byte ID of device to operate on
ds18b20_m_temp(byte in id[], sword out temperature) return bit
ds18b20_m_temp - read temperature from single device on bus Only use this procedure when there is only one device on the one_wire bus. behavior of this procedure (retry, converions) is influenced by constants, see lib header. return: true if success (crc okay).
ds18b20_s_read_rom() return bit
ds18b20_s_read_rom - read ID from single device on bus Only use this procedure when there is only one device on the one_wire bus. result is 8-byte ID in the scratchpad area return: true if success (crc okay).
ds18b20_s_temp(sword out temperature) return bit
ds18b20_s_temp - read temperature from single device on bus Only use this procedure when there is only one device on the one_wire bus. behavior of this procedure (retry, converions) is influenced by constants, see lib header. return: true if success (crc okay).
_ds18b20_read( byte in nbre_byte ) return bit
_ds18b20_read - read the requested number of bytes The result is stored in scratchpad for further processiong. crc of received data is calculated. parameter: nbre_byte: 8 when you read rom ID 9 when you read the scratchpad return: true if success (crc okay).
16f648a | 16f648a_ds18b20_single.jal |
16f877 | 16f877_ds18b20_single.jal |
16f877a | 16f877a_ds18b20_single.jal |
16f88 | 16f88_ds18b20_single.jal |
18f2450 | 18f2450_ds18b20_single.jal |
18f4550 | 18f4550_ds18b20_single.jal |
Author | William Welch Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | 2.4 |
The 25AA02E48 is pre-programmed with a unique EUI-48 address but also allows for user-generated non-volatile storage.
No dependency found
ee25_write(byte in addr, byte in data)
write the data to the specified address.
ee25_wr_status(byte in data)
optional routine for advanced operations. write the Status register (be careful)
ee25_read(byte in addr) return byte
read the data from the specified address
ee25_rd_status() return byte
optional routine for advanced operations. read the Status register
16f819 | 16f819_ee25aa02e48_lcd.jal |
Author | Matthew Schinkel, copyright (c) 2010, all rights reserved. |
Adapted-by | William Welch |
Compiler | >=2.4m |
read and write to 24lc02 i2c eeprom
http://groups.google.com/group/jallib
No dependency found
ee_24lc02_write(byte in ic_address, byte in mem_address, byte in data)
ee_24lc02_read(byte in ic_address, byte in mem_address, byte out data)
ee_24lc02_write(byte in ic_address, byte in mem_address, byte in data)
No documentation found
ee_24lc02_read(byte in ic_address, byte in mem_address, byte out data)
No documentation found
Author | Matthew Schinkel, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4m |
read and write to 24lc256 i2c eeprom
http://groups.google.com/group/jallib
No dependency found
ee_24lc256_read(byte in ic_address, word in mem_address, byte out data)
ee_24lc256_write(byte in ic_address, word in mem_address, byte in data)
ee_24lc256_read(byte in ic_address, word in mem_address, byte out data)
No documentation found
ee_24lc256_write(byte in ic_address, word in mem_address, byte in data)
No documentation found
16f877 | 16f877_24lc256.jal |
16f877a | 16f877a_24lc256.jal |
18f452 | 18f452_24lc256.jal |
18f4525 | 18f4525_24lc256.jal |
18f4550 | 18f4550_24lc256.jal |
18f4620 | 18f4620_24lc256.jal |
Author | Matthew Schinkel, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4k |
this library reads files & folders from a fat32 formatted media such as sd cards & hard disks. BETA VERSION!
http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx http://www.pjrc.com/tech/8051/ide/fat32.html http://en.wikipedia.org/wiki/File_Allocation_Table http://en.wikipedia.org/wiki/8.3_filename http://www.ntfs.com/fat-filenames.htm
This lib does not create file_name's on fat32 partitions, although it may in the future. Please see this article http://www.desktoplinux.com/news/NS4980952387.html?kc=rss before you think about implementing writing of file_names into your project.
var bit fat32_is_read_only at fat32_file_attrib : 0
const bit _FAT32_GET = 0
var dword fat32_file_cluster_address
const byte FAT32_ENTRY_DELETED = 0xE5
const bit _fat32_read = 0
var word fat32_fat_begin
var byte fat32_file_attrib
const _FAT32_ALL = 255
var byte fat32_file_extension[3]
var word _fat32_file_byte_count
const byte FAT32_ENTRY_IS_PART_OF_LONG_NAME = 0x0F
var byte fat32_file_attrib_filter = 0
var bit fat32_init_ok = FALSE
const byte FAT32_DIRECTORY = 0
var bit fat32_is_directory at fat32_file_attrib : 4
var dword _fat32_dir_last_cluster
var dword fat32_file_size
var bit _fat32_last_operation
var bit fat32_filter_is_hidden at fat32_file_attrib_filter : 1
const FAT32_PRINT_ALL = 0xFF
var byte*FAT32_ENTRIES_MAX fat32_current_file_number
var dword fat32_current_sector = 20
const _FAT32_SHORT_NAME = 2
var bit fat32_filter_is_read_only at fat32_file_attrib_filter : 0
var bit fat32_is_hidden at fat32_file_attrib : 1
const FAT32_PRINT_NUMBER = 2
const _FAT32_CLUSTER_LOCATION = 16
var byte fat32_short_file_name[8]
var dword fat32_sectors_per_fat
var dword fat32_root_dir_first_cluster
const _FAT32_EXTENSION = 4
const _FAT32_ATTRIB = 8
const FAT32_PRINT_TABLE = 16
var dword _fat32_dir_fragment_count
var bit fat32_filter_is_archive at fat32_file_attrib_filter : 5
var bit fat32_file_has_long_name
var bit fat32_is_archive at fat32_file_attrib : 5
var bit fat32_filter_is_system at fat32_file_attrib_filter : 2
var byte fat32_file_name_length
var bit fat32_filter_is_directory at fat32_file_attrib_filter : 4
var bit fat32_is_volume_id at fat32_file_attrib : 3
var dword _fat32_file_last_cluster
var volatile dword fat32_current_dir_location
var byte fat32_sectors_per_cluster
const FAT32_PRINT_LONG_FILE_NAME = 1
var word fat32_dir_file_count
var word _fat32_file_fragment_count
var dword fat32_current_cluster
const _FAT32_LONG_NAME = 1
const bit _FAT32_PUT = 1
var bit fat32_filter_is_volume_id at fat32_file_attrib_filter : 3
var bit fat32_is_system at fat32_file_attrib : 2
var dword fat32_cluster_begin
const bit _fat32_write = 1
const FAT32_PRINT_SIZE = 4
var dword current_address = 0xFFFFFFFF
var byte*3 _fat32_file_sector_count
const FAT32_PRINT_ATTRIBUTES = 64
const _FAT32_SIZE = 32
const FAT32_PRINT_DATE = 32
const byte FAT32_FILE = 1
const FAT32_PRINT_CLUSTER = 8
var word _fat32_fragment_number
fat32_read_file_sector()
fat32_file_create(byte in file_name[], byte in file_extension[])
fat32_read_file_sector_number(dword in file_sector_number)
fat32_set_dir_size(dword in dir_size)
fat32_start_file_write()
fat32_file_close()
fat32_cluster'put(dword in address, dword in value)
fat32_file_entry_data(bit in file_or_dir, bit in get_put, byte in data_type)
fat32_init(byte in primary_partition_number)
fat32_cluster_in_sector_buffer'put(byte in address, dword in value)
fat32_entry_delete(byte*FAT32_ENTRIES_MAX in file_number)
fat32_print_file_info(volatile byte out output_device, byte in options)
fat32_read_file_info(byte*FAT32_ENTRIES_MAX in file_number)
fat32_file_remove(word in file_number)
fat32_file_delete()
fat32_write_file_sector()
fat32_write_file_sector_number(dword in file_sector_number)
fat32_dir_create(byte in dirname[])
fat32_print_directory(volatile byte out output_device, byte in options)
fat32_set_file_size(dword in file_size)
fat32_print_sector_buffer_hex(volatile byte out device,word in bytes_per_line)
fat32_start_file_read()
_fat32_create_fat_clusters(dword in clusters_to_make, bit in file_or_dir)
_fat32_read_dir_info()
_fat32_set_size(bit in file_or_dir, dword in file_size)
_fat32_remove_fat_clusters(dword in clusters_to_remove, bit in file_or_dir)
_fat32_write_dir_sector_number(dword in dir_sector_number)
_fat32_read_boot_sector(byte in partition_select)
_fat32_read_fragments(dword in cluster_start, bit in file_or_dir)
_fat32_read_dir_sector_number(dword in dir_sector_number)
fat32_file_open(byte*FAT32_ENTRIES_MAX in file_number) return bit
fat32_cluster_in_sector_buffer'get(byte in address) return dword
fat32_cluster'get(dword in address) return dword
fat32_cd(byte*FAT32_ENTRIES_MAX in file_number) return bit
fat32_read_file_byte() return byte
fat32_read_file_byte_address(dword in address) return byte
var bit fat32_is_read_only at fat32_file_attrib : 0
No documentation found
const bit _FAT32_GET = 0
No documentation found
var dword fat32_file_cluster_address
hold the location of the files start cluster after file_read_info()
const byte FAT32_ENTRY_DELETED = 0xE5
Reads where file names in the current dir are stored, and stores them into fat32_entry_location[]
const bit _fat32_read = 0
No documentation found
var word fat32_fat_begin
the sector location of the file alocation table for current partition
var byte fat32_file_attrib
Create file fat32_file_attribute variables
const _FAT32_ALL = 255
GET IS OK
var byte fat32_file_extension[3]
holds file extension after file_read_info()
var word _fat32_file_byte_count
a byte counter within a sector
const byte FAT32_ENTRY_IS_PART_OF_LONG_NAME = 0x0F
entry has a few characters of a long file_name
var byte fat32_file_attrib_filter = 0
filter file attributes
var bit fat32_init_ok = FALSE
tells you if fat32 initalized ok or not.
const byte FAT32_DIRECTORY = 0
read fragment locations from fat, store in fat32_dir_fragments_start & fat32_dir_fragment_cluster_count arrays
var bit fat32_is_directory at fat32_file_attrib : 4
No documentation found
var dword _fat32_dir_last_cluster
No documentation found
var dword fat32_file_size
holds file size after file_read_info()
var bit _fat32_last_operation
last operation read or write
var bit fat32_filter_is_hidden at fat32_file_attrib_filter : 1
No documentation found
const FAT32_PRINT_ALL = 0xFF
No documentation found
var byte*FAT32_ENTRIES_MAX fat32_current_file_number
No documentation found
var dword fat32_current_sector = 20
get a cluster from anywhere within the fat (as an array of dwords)
const _FAT32_SHORT_NAME = 2
OK
var bit fat32_filter_is_read_only at fat32_file_attrib_filter : 0
No documentation found
var bit fat32_is_hidden at fat32_file_attrib : 1
No documentation found
const FAT32_PRINT_NUMBER = 2
No documentation found
const _FAT32_CLUSTER_LOCATION = 16
OK
var byte fat32_short_file_name[8]
holds file short name after file_read_info()
var dword fat32_sectors_per_fat
sectors per fat (fat32_sectors_per_fat * (512/4) * fat32_sectors_per_cluster = sectors available)
var dword fat32_root_dir_first_cluster
the location of the root dir's first cluster, (should be 2 only after init)
const _FAT32_EXTENSION = 4
OK
const _FAT32_ATTRIB = 8
OK
const FAT32_PRINT_TABLE = 16
No documentation found
var dword _fat32_dir_fragment_count
No documentation found
var bit fat32_filter_is_archive at fat32_file_attrib_filter : 5
No documentation found
var bit fat32_file_has_long_name
holds if the file name has a long file name after file_read_info()
var bit fat32_is_archive at fat32_file_attrib : 5
No documentation found
var bit fat32_filter_is_system at fat32_file_attrib_filter : 2
No documentation found
var byte fat32_file_name_length
holds the size of the long file_name
var bit fat32_filter_is_directory at fat32_file_attrib_filter : 4
No documentation found
var bit fat32_is_volume_id at fat32_file_attrib : 3
No documentation found
var dword _fat32_file_last_cluster
No documentation found
var volatile dword fat32_current_dir_location
sector location of last dir read
var byte fat32_sectors_per_cluster
the number of sectors per cluster, usually 8
const FAT32_PRINT_LONG_FILE_NAME = 1
Print a file_name to an output device. Use the following constants as input options.
var word fat32_dir_file_count
number of files in current directory
var word _fat32_file_fragment_count
No documentation found
var dword fat32_current_cluster
No documentation found
const _FAT32_LONG_NAME = 1
Get or put file information such as file name, extension, attributes, etc of the currently opened file or directory hopefully will replace file_get_info FAT32_DIR = Current Directory FAT32_file = Currently selected file number
const bit _FAT32_PUT = 1
PUT/SAVE FILE INFO
var bit fat32_filter_is_volume_id at fat32_file_attrib_filter : 3
No documentation found
var bit fat32_is_system at fat32_file_attrib : 2
No documentation found
var dword fat32_cluster_begin
the location of the beginning of clusters (where files & folders data is)
const bit _fat32_write = 1
No documentation found
const FAT32_PRINT_SIZE = 4
No documentation found
var dword current_address = 0xFFFFFFFF
reads selected byte from a file. fragmented files work. slower then fat32_read_file() procedure, but user friendly.
var byte*3 _fat32_file_sector_count
other intarnal vars
const FAT32_PRINT_ATTRIBUTES = 64
No documentation found
const _FAT32_SIZE = 32
OK
const FAT32_PRINT_DATE = 32
No documentation found
const byte FAT32_FILE = 1
No documentation found
const FAT32_PRINT_CLUSTER = 8
No documentation found
var word _fat32_fragment_number
the fragment number being used
fat32_read_file_sector()
read one sector from a file starting at the beginning of the file. auto increments to next sector in file. fragmented files work. requires: fat32_start_file_read(fat32_file_location), fat32_stop_file_read() faster then fat32_read_file_sector_number() procedure
fat32_file_create(byte in file_name[], byte in file_extension[])
create a file with a size of 0 bytes in the current directory. Set fat32_attrib before running this procedure not for directories. see fat32_dir_create()
fat32_read_file_sector_number(dword in file_sector_number)
reads selected sector from a file. fragmented files work. slower then fat32_read_file_sector() procedure, but user friendly.
fat32_set_dir_size(dword in dir_size)
Sets the size of the currently opened directory
fat32_start_file_write()
Start writing to a file
fat32_file_close()
close the currently opened file.
fat32_cluster'put(dword in address, dword in value)
No documentation found
fat32_file_entry_data(bit in file_or_dir, bit in get_put, byte in data_type)
No documentation found
fat32_init(byte in primary_partition_number)
initalize fat32
fat32_cluster_in_sector_buffer'put(byte in address, dword in value)
get a cluster from the sector buffer (as an array of dwords)
fat32_entry_delete(byte*FAT32_ENTRIES_MAX in file_number)
Delete a fat32 directory entry. not finnished yet. requires dir refresh with _fat32_read_dir_info() after, otherwise file will still show in dir listing.
fat32_print_file_info(volatile byte out output_device, byte in options)
No documentation found
fat32_read_file_info(byte*FAT32_ENTRIES_MAX in file_number)
reads file info such as file_name, file size, filelocation, etc. into memory.
fat32_file_remove(word in file_number)
not working, it's on the todo list
fat32_file_delete()
Delete a file. not finnished yet. requires dir refresh with _fat32_read_dir_info() after, otherwise file will still show in dir listing.
fat32_write_file_sector()
write one sector to a file starting at the beginning of the file. auto increments to next sector in file. fragmented files work. requires: fat32_start_file_write(fat32_file_location), fat32_stop_file_write faster then fat32_write_file_sector_number() procedure
fat32_write_file_sector_number(dword in file_sector_number)
writes selected sector to a file. fragmented files work. slower then fat32_write_file_sector() procedure, but user friendly.
fat32_dir_create(byte in dirname[])
Creates a directory. not finnished yet.
fat32_print_directory(volatile byte out output_device, byte in options)
print the current directory to an output device. Use same options as in fat32_print_file_info
fat32_set_file_size(dword in file_size)
Sets the size of the currently opened file
fat32_print_sector_buffer_hex(volatile byte out device,word in bytes_per_line)
the sector buffer
fat32_start_file_read()
Start reading a file
_fat32_create_fat_clusters(dword in clusters_to_make, bit in file_or_dir)
Creates clusters for a file or directory
_fat32_read_dir_info()
No documentation found
_fat32_set_size(bit in file_or_dir, dword in file_size)
Sets the size of the current file or directory
_fat32_remove_fat_clusters(dword in clusters_to_remove, bit in file_or_dir)
Removes clusters for a file or directory
_fat32_write_dir_sector_number(dword in dir_sector_number)
writes selected sector to a directory. fragmented dirs should work (not tested)
_fat32_read_boot_sector(byte in partition_select)
Reads a fat32 boot sector to get the location of the root directory and FAT Location on the media for the partition selected. Only primary partitions are supported. Secondary partitions are not.
_fat32_read_fragments(dword in cluster_start, bit in file_or_dir)
No documentation found
_fat32_read_dir_sector_number(dword in dir_sector_number)
reads selected sector from a directory. fragmented dirs should work (not tested)
fat32_file_open(byte*FAT32_ENTRIES_MAX in file_number) return bit
check if file is ok to start reading, returns 1 = success, 0 = not a file
fat32_cluster_in_sector_buffer'get(byte in address) return dword
put a cluster into the sector buffer (as an array of dwords)
fat32_cluster'get(dword in address) return dword
put a cluster into anywhere within the fat (as an array of dwords)
fat32_cd(byte*FAT32_ENTRIES_MAX in file_number) return bit
change directory, returns 1 = success, 0 = not a directory
fat32_read_file_byte() return byte
read one byte from a file starting at the beginning of the file. auto increments to next byte in file. fragmented files work. requires: fat32_start_file_read(fat32_file_location), fat32_stop_file_read() faster then fat32_read_file_address() procedure
fat32_read_file_byte_address(dword in address) return byte
No documentation found
Author | Matthew Schinkel, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4k |
This library reads files & folders from a fat32 formatted sd card. This small version only supports the first partition, and only one file.
http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx http://www.pjrc.com/tech/8051/ide/fat32.html http://en.wikipedia.org/wiki/File_Allocation_Table
1. First format your device with fat32 before using this library. 2. Do not put other files onto the storage device. This library will overwrite and erase existing files on the storage device because only one file is supported, and no fragments are supported.
No dependency found
var bit fat32_small_open_for_read = FALSE
var bit fat32_small_open_for_write = FALSE
const byte FAT32_SMALL_VOL_ID_DATA[32] = {
const byte FAT32_SMALL_FILE_NAME_DATA[28] ={
const dword FAT32_SMALL_FILE_LOCATION = 0x03
var dword fat32_small_fat_begin
const byte FAT32_SMALL_FAT_DATA[12] = {
var dword fat32_small_file_size
var dword fat32_small_root_dir
var dword _file_sector_number
var byte fat32_small_sectors_per_cluster
var dword fat32_small_cluster_begin
var byte _fat32_small_file_size[4] at fat32_small_file_size
fat32_small_init()
fat32_small_set_file_size(dword in file_size)
fat32_small_file_open(dword in file_sector_number)
fat32_small_file_read(byte out data)
fat32_small_read_boot_sector()
fat32_small_file_write(byte in data)
fat32_small_file_close()
var bit fat32_small_open_for_read = FALSE
No documentation found
var bit fat32_small_open_for_write = FALSE
No documentation found
const byte FAT32_SMALL_VOL_ID_DATA[32] = {
root dir constant
const byte FAT32_SMALL_FILE_NAME_DATA[28] ={
file name entry constant
const dword FAT32_SMALL_FILE_LOCATION = 0x03
No documentation found
var dword fat32_small_fat_begin
the location of the file alocation table for current partition
const byte FAT32_SMALL_FAT_DATA[12] = {
start data for the fat (file allocation table)
var dword fat32_small_file_size
holds file size after file_read_info()
var dword fat32_small_root_dir
sector location of the root dir
var dword _file_sector_number
Open the file
var byte fat32_small_sectors_per_cluster
the number of sectors per cluster, usually 8
var dword fat32_small_cluster_begin
the location of the beginning of clusters (where files & folders data is)
var byte _fat32_small_file_size[4] at fat32_small_file_size
other vars
fat32_small_init()
initalize fat32
fat32_small_set_file_size(dword in file_size)
Set the size of the file.
fat32_small_file_open(dword in file_sector_number)
No documentation found
fat32_small_file_read(byte out data)
Read data from the file
fat32_small_read_boot_sector()
Reads a fat32 boot sector to get the location of the root directory and FAT Location on the media for the partition selected. Only one partition is supported.
fat32_small_file_write(byte in data)
Write data to the file
fat32_small_file_close()
Close the file
Author | Stef Mientki, Copyright (c) 2002 .. 2006, all rights reserved. |
Adapted-by | Joep Suijs, Albert Faber, Eur van Andel |
Compiler | >=2.2 |
Outputs variables to output device. Writes formatted signed/unsiged bytes/words to the specified output device. Decimal (with fraction), Hex and Time formats available. Example: var sword BHL = -684 ; send the signed word to the LCD display ; total field width 6 chars, including sign and decimal ; with 2 digits behind the decimal point format_sword_dec(LCD_char,BHL,6,2) ; and now send the same signed word to the serial port format_sword_dec(Serial_HW_data,BHL,6,2)
No dependency found
format_time_hms(volatile byte out device,byte in HH, byte in MM, byte in SS)
format_byte_dec(volatile byte out device, byte in data, byte in n_tot, byte in n2)
format_time_hm_word(volatile byte out device,word in minutes)
format_sbyte_dec(volatile byte out device, sbyte in data, byte in n_tot, byte in n2)
format_sdword_dec(volatile byte out device, sdword in data, byte in n_tot, byte in n2)
format_dword_dec(volatile byte out device, dword in data, byte in n_tot, byte in n2)
format_dword_hex(volatile byte out device, dword in data)
format_word_dec(volatile byte out device, word in data, byte in n_tot, byte in n2)
format_byte_hex(volatile byte out device, byte in data)
format_word_hex(volatile byte out device, word in data)
format_sword_dec(volatile byte out device, sword in data, byte in n_tot, byte in n2)
format_time_hm(volatile byte out device,byte in HH, byte in MM)
_write_real_digit(volatile byte out device)
_write_digit(volatile byte out device, byte in digit, bit in point)
var bit _format_signed = false
No documentation found
var byte _format_digit
No documentation found
var byte _format_leader
global vars
var byte _format_sign
No documentation found
format_time_hms(volatile byte out device,byte in HH, byte in MM, byte in SS)
Displays a time in HH:MM:SS notation at specified position Hours and minutes are specified separate
format_byte_dec(volatile byte out device, byte in data, byte in n_tot, byte in n2)
writes decimal formatted byte to output device the output can be specified as a fraction n_tot = the total length (including sign and decimal point) n2 = number of digits behind the point
format_time_hm_word(volatile byte out device,word in minutes)
Displays a time in HH:MM notation at specified position the input is specified in minutes
format_sbyte_dec(volatile byte out device, sbyte in data, byte in n_tot, byte in n2)
writes decimal formatted signed byte to output device the output can be specified as a fraction n_tot = the total length (including sign and decimal point) n2 = number of digits behind the point
format_sdword_dec(volatile byte out device, sdword in data, byte in n_tot, byte in n2)
writes decimal formatted signed dword to output device the output can be specified as a fraction n_tot = the total length (including sign and decimal point) n2 = number of digits behind the point
format_dword_dec(volatile byte out device, dword in data, byte in n_tot, byte in n2)
writes decimal formatted dword to output device the output can be specified as a fraction n_tot = the total length (including sign and decimal point) n2 = number of digits behind the point
format_dword_hex(volatile byte out device, dword in data)
writes hex formatted dword to output device
format_word_dec(volatile byte out device, word in data, byte in n_tot, byte in n2)
writes decimal formatted word to output device the output can be specified as a fraction n_tot = the total length (including sign and decimal point) n2 = number of digits behind the point
format_byte_hex(volatile byte out device, byte in data)
writes hex formatted byte to output device
format_word_hex(volatile byte out device, word in data)
writes hex formatted word to output device
format_sword_dec(volatile byte out device, sword in data, byte in n_tot, byte in n2)
writes decimal formatted signed word to output device the output can be specified as a fraction n_tot = the total length (including sign and decimal point) n2 = number of digits behind the point
format_time_hm(volatile byte out device,byte in HH, byte in MM)
Displays a time in HH:MM notation at specified position Hours and minutes are specified separate
_write_real_digit(volatile byte out device)
_write_digit(volatile byte out device, byte in digit, bit in point)
Author | Andre Miller Copyright (c) 2008..2010, all rights reserved. |
Adapted-by | Richard Zengerink |
Compiler | >=2.4m |
library 5X7 font lookup table for Nokia 3310 display with pcd8544 controller
http://www.amontec.com/lcd_nokia_3310.shtml
No dependency found
const byte FONT_5X7_CHARS[] =
const byte FONT_5X7_BYTE_PER_CHAR = 5
const byte FONT_5X7_WIDTH = 5
const byte FONT_5X7_BIT_DIRECTION = FONT_BOTTOM_LEFT_VERTICAL
const byte FONT_5X7 = 0x01
const byte FONT_5X7_HEIGHT = 7
const byte FONT_5X7_CHARS[] =
No documentation found
const byte FONT_5X7_BYTE_PER_CHAR = 5
No documentation found
const byte FONT_5X7_WIDTH = 5
No documentation found
const byte FONT_5X7_BIT_DIRECTION = FONT_BOTTOM_LEFT_VERTICAL
No documentation found
const byte FONT_5X7 = 0x01
font ID, unique amongst font libs
const byte FONT_5X7_HEIGHT = 7
No documentation found
18f4620 | 18f4620_glcd_touch_stm032qvt_003.jal |
Author | Richard Zengerink Copyright (c) 2008..2010, all rights reserved. |
Adapted-by | |
Compiler | >=2.4m |
library 6X8 font lookup table for Nokia 3310 display with pcd8544 controller
http://www.amontec.com/lcd_nokia_3310.shtml
No dependency found
const byte FONT_6X8_CHARS[] =
const byte FONT_6X8_WIDTH = 6
const byte FONT_6X8_BYTE_PER_CHAR = 6
const byte FONT_6X8_BIT_DIRECTION = FONT_BOTTOM_LEFT_VERTICAL
const byte FONT_6X8_HEIGHT = 8
const byte FONT_6X8 = 0x02
const byte FONT_6X8_CHARS[] =
No documentation found
const byte FONT_6X8_WIDTH = 6
No documentation found
const byte FONT_6X8_BYTE_PER_CHAR = 6
No documentation found
const byte FONT_6X8_BIT_DIRECTION = FONT_BOTTOM_LEFT_VERTICAL
No documentation found
const byte FONT_6X8_HEIGHT = 8
No documentation found
const byte FONT_6X8 = 0x02
font ID, unique amongst font libs
18f4620 | 18f4620_glcd_touch_stm032qvt_003.jal |
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4k |
This sample can contain any 8X12 size font tables.
http://www.divshare.com/download/11463401-4a9
See lib glcd_font.jal for font explanation
No dependency found
const byte FONT_8X12_HEIGHT = 12
const byte FONT_8X12 = 0x03
const byte FONT_8X12_BIT_DIRECTION = FONT_TOP_LEFT_HORIZONTAL
const byte FONT_8X12_BYTE_PER_CHAR = 12
const byte FONT_8X12_CHARS [] = {
const byte FONT_8X12_WIDTH = 8
const byte FONT_8X12_HEIGHT = 12
No documentation found
const byte FONT_8X12 = 0x03
font ID, unique amongst font libs
const byte FONT_8X12_BIT_DIRECTION = FONT_TOP_LEFT_HORIZONTAL
No documentation found
const byte FONT_8X12_BYTE_PER_CHAR = 12
No documentation found
const byte FONT_8X12_CHARS [] = {
No documentation found
const byte FONT_8X12_WIDTH = 8
No documentation found
18f4620 | 18f4620_glcd_touch_stm032qvt_003.jal |
Author | Stef Mientki, Serkan Ayyýldýz Copyright (c) 2006..2009, all rights reserved. |
Adapted-by | Joep Suijs, Matthew Schinkel |
Compiler | >=2.2 |
Generic routines for graphic lcd glcd_box glcd_line Defines a common API, a common interface, where several parameters and procedures remains device specific and should be implemented in device library. Once interface is implemented, many features come for "free". This common API is defined in glcd_common.jal and glcd_font.jal In order to honor this common interface, and benefit its features, the following must be implemented in device specific library: * GLCD_X_PIXELS: (const) specifies display's width, in pixels * GLCD_Y_SIZE: (const) specifies display's height, in pixels * GLCD_COLOR_BITS: (const) specifies the number of bits required for colors (1 for black & white), (16 for 16 bit color) * glcd_pen_color: (var|const) specifies color of the pen * glcd_background_color: (var|const) specifies the background color * glcd_write_char(x,y,char): (proc) draw "char" at position (x,y). If no glcd_write_char is defined in the device specific library, pixel by pixel method will be used by default for glcd_font.jal. * glcd_write_pixel(x,y): (proc) assuming pen and background color previously set, draw a pixel at position (x,y) using defined colors. This is the main procedure used by pixel-related features, like drawing a line, circle, etc... In some cases, where glcd_write_char() can't be used glcd_write_pixel() can also be used to draw chars. If not implemented, pixel-related features won't be available.
glcd'put(byte in char)
glcd_ellipse(byte*GLCD_X_SIZE in cx,byte*GLCD_Y_SIZE in cy, byte in xradius,byte in yradius)
glcd_char_goto(byte in x, byte in y)
glcd_line(byte*GLCD_X_SIZE in x0,byte*GLCD_Y_SIZE in y0, byte*GLCD_X_SIZE in x1, byte*GLCD_Y_SIZE in y1)
glcd_write_char_pbp(byte*GLCD_X_SIZE in x,byte*GLCD_Y_SIZE in y,byte in value)
glcd_box_fill(byte*GLCD_X_SIZE in x0, byte*GLCD_Y_SIZE in y0, byte*GLCD_X_SIZE in x1, byte*GLCD_Y_SIZE in y1)
glcd_circle(byte*GLCD_X_SIZE in cx, byte*GLCD_Y_SIZE in cy, byte in radius)
glcd_box(byte*GLCD_X_SIZE in x0, byte*GLCD_Y_SIZE in y0, byte*GLCD_X_SIZE in x1, byte*GLCD_Y_SIZE in y1)
var byte*GLCD_X_SIZE glcd_char_x_pos = 0;
variables for text positioning
var byte*GLCD_Y_SIZE glcd_char_y_pos = 0;
No documentation found
glcd'put(byte in char)
No documentation found
glcd_ellipse(byte*GLCD_X_SIZE in cx,byte*GLCD_Y_SIZE in cy, byte in xradius,byte in yradius)
No documentation found
glcd_char_goto(byte in x, byte in y)
No documentation found
glcd_line(byte*GLCD_X_SIZE in x0,byte*GLCD_Y_SIZE in y0, byte*GLCD_X_SIZE in x1, byte*GLCD_Y_SIZE in y1)
No documentation found
glcd_write_char_pbp(byte*GLCD_X_SIZE in x,byte*GLCD_Y_SIZE in y,byte in value)
No documentation found
glcd_box_fill(byte*GLCD_X_SIZE in x0, byte*GLCD_Y_SIZE in y0, byte*GLCD_X_SIZE in x1, byte*GLCD_Y_SIZE in y1)
No documentation found
glcd_circle(byte*GLCD_X_SIZE in cx, byte*GLCD_Y_SIZE in cy, byte in radius)
No documentation found
glcd_box(byte*GLCD_X_SIZE in x0, byte*GLCD_Y_SIZE in y0, byte*GLCD_X_SIZE in x1, byte*GLCD_Y_SIZE in y1)
No documentation found
16f877 | 16f877_glcd_ks0108.jal |
16f877a | 16f877a_glcd_ks0108.jal |
18f4550 | 18f4550_glcd_ks0108.jal |
18f4620 | 18f4620_glcd_touch_stm032qvt_003.jal |
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4k |
Main font library. API: include as many font library as you want, then include this one. Define which font you want to use during programm execution, calling glcd_font_use(font_id). Font lookup (retrieving a char) is done using glcd_font_lookup(idx)
http://www.divshare.com/download/11463401-4a9
Fonts have an ID, unique amongst all font libraries. ID goes from 0x01 to 0xFE (0x00 and 0xFF are reserved for internal usage). Fonts which are part of jallib distribution have their ID starting from 0x01, increasing. There are also "slots" for user-defined libraries, starting from 0xFE, decreasing. This way all jallib IDs are consecutive, so are user-defined. This leaves room for 253 fonts. Each font library addition involves updating procedures glcd_font_use() and glcd_font_lookup(). Font name usually includes information about its Width x Height (eg. FONT_5X7). A font library often declares characters, but can also declares other kind of stuff (like sprites). Example: FONT_9X12_TOP_RIGHT_HORIZONTAL_MY_FONT_NAME Your lcd will most likely only support one font bit order. This example is 9x12 (font_top_right_horizontal) const byte FONT_9x12_0_NONAME[] = {0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00} -- "!" -horizontal---> 0 0 0 0 0 0 0 0 0 -- 0x00 0x00 0 0 0 0 0 0 0 0 0 -- 0x00 0x00 0 0 1 0 0 0 0 0 0 -- 0x20 0x00 0 0 1 0 0 0 0 0 0 -- 0x20 0x00 0 0 1 0 0 0 0 0 0 -- 0x20 0x00 0 0 1 0 0 0 0 0 0 -- 0x20 0x00 0 0 1 0 0 0 0 0 0 -- 0x20 0x00 0 0 1 0 0 0 0 0 0 -- 0x20 0x00 0 0 0 0 0 0 0 0 0 -- 0x00 0x00 0 0 1 0 0 0 0 0 0 -- 0x20 0x00 0 0 0 0 0 0 0 0 0 -- 0x00 0x00 0 0 0 0 0 0 0 0 0 -- 0x00 0x00 This example is FONT_9x12_7_NONAME (FONT_BOTTOM_LEFT_VERTICAL) const byte font_table[] = {0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x2F0C 0x0000 0x0000} -- "!" 0 0 0 0 0 0 0 0 0 ^ 0 0 0 0 0 0 0 0 0 | 0 0 1 0 0 0 0 0 0 L 0 0 1 0 0 0 0 0 0 A 0 0 1 0 0 0 0 0 0 C 0 0 1 0 0 0 0 0 0 I 0 0 1 0 0 0 0 0 0 T 0 0 1 0 0 0 0 0 0 R 0 0 0 0 0 0 0 0 0 E 0 0 1 0 0 0 0 0 0 V 0 0 0 0 0 0 0 0 0 | 0 0 0 0 0 0 0 0 0 | 0x0000 0x0000 0x2F0C 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
No dependency found
var byte _glcd_font_current_bit_direction
const bit GLCD_FONT_USAGE = true
var byte _glcd_font_current_id
var byte _glcd_font_current_width
var byte _glcd_font_current_height
var byte _glcd_font_current_byte_per_char
var byte _glcd_font_current_bit_direction
No documentation found
const bit GLCD_FONT_USAGE = true
flag: do we use font & chars related features ?
var byte _glcd_font_current_id
No documentation found
var byte _glcd_font_current_width
No documentation found
var byte _glcd_font_current_height
No documentation found
var byte _glcd_font_current_byte_per_char
No documentation found
glcd_font_use(byte in font_id)
No documentation found
glcd_font_lookup(word in idx) return byte
No documentation found
18f4620 | 18f4620_glcd_touch_stm032qvt_003.jal |
Author | Serkan Ayyýldýz Copyright (c) 2006..2009, all rights reserved. |
Adapted-by | Joep Suijs |
Compiler | >=2.2 |
Library for KS0108 compatible graphic lcd with 128x64 resolution.
No dependency found
const byte GLCD_WHITE = 0x00
const byte GLCD_X_PIXELS = 128
const byte GLCD_BLACK = 0x01
const KS0108_CMD_COLUMN = 0x40
const byte GLCD_COLOR_BITS = 1
const byte GLCD_Y_PIXELS = 64
const KS0108_CMD_OFF = 0x3E
var byte glcd_pen_color = GLCD_BLACK
const KS0108_RIGHT = 1
const KS0108_CMD_ON = 0x3F
const byte _font_5x7_table[] = {
const KS0108_CMD_TOP_RAM = 0xC0
var byte lcd_background_color = GLCD_WHITE
const KS0108_CMD_PAGE = 0xB8
const KS0108_LEFT = 0
lcd_write_char(byte in x, byte in y, byte in ch )
ks0108_write_char(byte in x, byte in y, byte in ch )
ks0108_write_byte(byte in x, byte in y, byte in veri)
glcd_init()
lcd_on()
glcd_write_pixel(byte in x, byte in y)
lcd_off()
lcd_fill(byte in data)
_ks0108_column(byte in side, byte in column)
_ks0108_data()
_ks0108_write(byte in side, byte in data)
_ks0108_page(byte in side , byte in page)
_ks0108_inst()
const byte GLCD_WHITE = 0x00
No documentation found
const byte GLCD_X_PIXELS = 128
No documentation found
const byte GLCD_BLACK = 0x01
constant colors
const KS0108_CMD_COLUMN = 0x40
No documentation found
const byte GLCD_COLOR_BITS = 1
black & white, monochrome
const byte GLCD_Y_PIXELS = 64
No documentation found
const KS0108_CMD_OFF = 0x3E
No documentation found
var byte glcd_pen_color = GLCD_BLACK
Default pen color
const KS0108_RIGHT = 1
No documentation found
const KS0108_CMD_ON = 0x3F
No documentation found
const byte _font_5x7_table[] = {
_font_5x7_table[] - character table 91 * 5 bytes = 455
const KS0108_CMD_TOP_RAM = 0xC0
No documentation found
var byte lcd_background_color = GLCD_WHITE
Default background color
const KS0108_CMD_PAGE = 0xB8
No documentation found
const KS0108_LEFT = 0
No documentation found
lcd_write_char(byte in x, byte in y, byte in ch )
Same as ks0108_write_char, but can use external or user defined font library.
ks0108_write_char(byte in x, byte in y, byte in ch )
Writes an inverted character to the display using internal font definition. note: the vertical position of chars is in 8-bit steps.
ks0108_write_byte(byte in x, byte in y, byte in veri)
ks0108_write_byte - write byte to display x = pixel column y = pixel row (will be divided by 8)
glcd_init()
lcd_init - Initialize the graphic LCD. Call before using any other LCD function.
lcd_on()
Purpose: Turn the display on
glcd_write_pixel(byte in x, byte in y)
Purpose: Turn a pixel on a graphic LCD on or off Inputs: 1) x - the x coordinate of the pixel 2) y - the y coordinate of the pixel
lcd_off()
Purpose: Turn the display off
lcd_fill(byte in data)
Purpose: Fill the LCD screen with the passed in color Inputs: ON - turn all the pixels on OFF - turn all the pixels off
_ks0108_column(byte in side, byte in column)
Purpose: Set the column address Inputs: The column address (0 - 63)
_ks0108_data()
Purpose: Specify reads and writes are data
_ks0108_write(byte in side, byte in data)
_ks0108_write - Write a byte of data to the specified chip Inputs: 1) side - which chip to write the data to 2) data - the byte of data to write
_ks0108_page(byte in side , byte in page)
Purpose: Set the page number Inputs: A page number (0 - 7)
_ks0108_inst()
Purpose: Specify reads and writes are instructions
ks0108_read_byte(byte in x, byte in y) return byte
ks0108_read_byte - read byte to display x = pixel column y = pixel row (will be divided by 8)
_ks0108_read(byte in side) return byte
Purpose: Reads a byte of data from the specified chip Ouputs: A byte of data read from the chip
16f877 | 16f877_glcd_ks0108.jal |
16f877a | 16f877a_glcd_ks0108.jal |
18f4550 | 18f4550_glcd_ks0108.jal |
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4k |
Library for Color GLCD 320x240 stm032qvt-003 TFT display. Internal TFT GLCD driver is HX8347-A.
http://www.divshare.com/download/11463401-4a9
This library must use fonts with horizontal bit alignment
const GLCD_GREEN = 0x07E0
const GLCD_TEAL = 0x07ff
const GLCD_Y_PIXELS = 320
const GLCD_BLOCK_WRITE_TYPE = FONT_TOP_LEFT_HORIZONTAL
var word glcd_background_color = GLCD_WHITE
const GLCD_COLOR_BITS = 16
const GLCD_BLACK = 0x0000
const GLCD_YELLOW = 0xffe0
const GLCD_X_PIXELS = 240
const GLCD_WHITE = 0xFFFF
var word glcd_pen_color = GLCD_BLACK
const GLCD_BLUE = 0x001f
const GLCD_RED = 0xf800
glcd_write_pixel(byte in x,word in y)
stm_glcd_write_command_data(word in com1,word in dat1)
glcd_clear_screen()
stm_glcd_write_command(word in data)
stm_glcd_init()
glcd_write_color_byte(byte in data_high,byte in data_low)
glcd_write_color(word in data)
stm_glcd_write_data(word in data)
const GLCD_GREEN = 0x07E0
Green
const GLCD_TEAL = 0x07ff
Teal
const GLCD_Y_PIXELS = 320
No documentation found
const GLCD_BLOCK_WRITE_TYPE = FONT_TOP_LEFT_HORIZONTAL
efficient font type
var word glcd_background_color = GLCD_WHITE
Default background color
const GLCD_COLOR_BITS = 16
16bit color, 65535 colors
const GLCD_BLACK = 0x0000
colors constants
const GLCD_YELLOW = 0xffe0
Yellow
const GLCD_X_PIXELS = 240
No documentation found
const GLCD_WHITE = 0xFFFF
White
var word glcd_pen_color = GLCD_BLACK
Default pen color
const GLCD_BLUE = 0x001f
Blue
const GLCD_RED = 0xf800
Red
glcd_write_pixel(byte in x,word in y)
No documentation found
stm_glcd_write_command_data(word in com1,word in dat1)
No documentation found
glcd_clear_screen()
No documentation found
stm_glcd_write_command(word in data)
No documentation found
stm_glcd_init()
No documentation found
glcd_write_color_byte(byte in data_high,byte in data_low)
No documentation found
glcd_write_color(word in data)
No documentation found
stm_glcd_write_data(word in data)
No documentation found
18f4620 | 18f4620_glcd_touch_stm032qvt_003.jal |
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4k |
Library for GLCD touch controller & A/D device ad7843. used with GLCD's such as stm032qvt-003
http://www.divshare.com/download/11463401-4a9
No dependency found
var bit*3 touch_register at _touch_settings : 4
const bit*3 TOUCH_REG_IN3 = 0b010
const TOUCH_12_BIT = 0
const bit*3 TOUCH_REG_IN4 = 0b110
const TOUCH_INTERRUPT_ENABLE = 0
var bit touch_ser_dfr at _touch_settings : 2
const TOUCH_INTERRUPT_DISABLED = 1
var bit touch_pd0 at _touch_settings : 0
const bit*3 TOUCH_REG_Y = 0b001
var byte _touch_settings
const TOUCH_8_BIT = 1
const TOUCH_AD_SINGLE_ENDED = 1
var bit touch_mode at _touch_settings : 3
var bit touch_pd1 at _touch_settings : 1
const TOUCH_LOW_POWER = 0
const TOUCH_AD_DIFFERENTIAL = 0
var bit touch_start_bit at _touch_settings : 7
const bit*3 TOUCH_REG_X = 0b101
const TOUCH_HIGH_POWER = 1
var bit*3 touch_register at _touch_settings : 4
register select bits
const bit*3 TOUCH_REG_IN3 = 0b010
read analog input IN3
const TOUCH_12_BIT = 0
modes
const bit*3 TOUCH_REG_IN4 = 0b110
read analog input IN4
const TOUCH_INTERRUPT_ENABLE = 0
interrupt setting constants
var bit touch_ser_dfr at _touch_settings : 2
A/D reference mode
const TOUCH_INTERRUPT_DISABLED = 1
No documentation found
var bit touch_pd0 at _touch_settings : 0
interrupt enable bit
const bit*3 TOUCH_REG_Y = 0b001
read y
var byte _touch_settings
command byte
const TOUCH_8_BIT = 1
No documentation found
const TOUCH_AD_SINGLE_ENDED = 1
No documentation found
var bit touch_mode at _touch_settings : 3
resolution mode. 0 = 12bit, 1 = 8bit
var bit touch_pd1 at _touch_settings : 1
power management bit
const TOUCH_LOW_POWER = 0
power setting constants
const TOUCH_AD_DIFFERENTIAL = 0
A/D reference modes
var bit touch_start_bit at _touch_settings : 7
register write start bit
const bit*3 TOUCH_REG_X = 0b101
registers
const TOUCH_HIGH_POWER = 1
No documentation found
touch_init()
No documentation found
touch_read_xy_8_bit(byte in out x, byte in out y)
No documentation found
18f4620 | 18f4620_glcd_touch_stm032qvt_003.jal |
Author | Eur van Andel, eur@fiwihex.nl Copyright (c) 2008 |
Adapted-by | |
Compiler | =2.4h |
The Sensirion SHT1x/SHT7x is a single chip relative humidity and temperature multi sensor module comprising a calibrated digital output. It comes in 5 flavors, with different accuracy and package style: sensor hum acc temp acc package SHT10 4.5% 0.5C SMD (LCC) SHT11 3.0% 0.4C SMD (LCC) SHT15 2.0% 0.3C SMD (LCC) SHT71 3.0% 0.4C 4-pin single-in-line SHT75 1.8% 0.3C 4-pin single-in-line all consist of the same silicon: the less accurate models are sold cheaper. My experience is mixed: I've seen some consistent +2C offset in temperature, but good humidty measurements. The 4-pin package breaks when you touch it. The SMD package has naked tracks underneath: you can't route under it! If exposed to >95% RH for 10 minutes, these sensors will go beserk and need <60% RH for an hour to recover. You might try heating them. protocol is close to I2C, but not the same. Remember to pull up DATA. 0b0000_0011 starts temperature measurement 0b0000_0101 starts humidity measurement device returns three bytes: MSB, LSB and CRC this library doesn't perform any CRC check
http://www.sensirion.com/en/01_humidity_sensors/00_humidity_sensors.htm
read_raw_hum_sht(byte out MSB, byte out LSB, byte out CRC)
read_hum_word_sht(word out hum)
sht_get_data(byte out x)
sht_start()
sht_put_ack()
sht_conn_reset()
sht_wait_ack()
sht_reset()
read_centicelsius_temp_sht(sword out centicelsius)
sht_put_data(byte in x)
read_celsius_temp_sht(sbyte out celsius)
read_hum_sht(byte out hum)
read_raw_temp_sht(byte out MSB, byte out LSB, byte out CRC)
read_raw_hum_sht(byte out MSB, byte out LSB, byte out CRC)
read raw 12-bit humidity from SHT default value of resolution bit is 12 bit RH SHT takes 55 ms for measurement @ 12 bits we will wait 70 ms SHT may only be switched on for 10% of the time because of self-heating so this measurement can only happen every 500ms
read_hum_word_sht(word out hum)
read humidity from SHT, result in word precision 0.01%RH SHT may only be switched on for 10% of the time because of self-heating so this measurement can only happen every 500ms
sht_get_data(byte out x)
receive one byte from the SHT
sht_start()
send start _____ ________ DATA: |_______| ___ ___ SCK : ___| |___| |______
sht_put_ack()
send ACK
sht_conn_reset()
reset SHT interface, must be followed with sht_start and command
sht_wait_ack()
pretend to wait for ACK
sht_reset()
reset SHT
read_centicelsius_temp_sht(sword out centicelsius)
read Celcius temperature from SHT with 0.01 C resolution, result is sword type, so -327.68 .. +327.68 C SHT takes 320 ms for measurement @ 14 bits we will wait 400 ms SHT may only be switched on for 10% of the time because of self-heating so this measurement can only happen every four seconds!
sht_put_data(byte in x)
send one byte to the SHT
read_celsius_temp_sht(sbyte out celsius)
read Celcius temperature from SHT with 1 C resolution, result is sbyte type, so -126...+127C SHT takes 320 ms for measurement @ 14 bits we will wait 400 ms SHT may only be switched on for 10% of the time because of self-heating so this measurement can only happen every four seconds!
read_hum_sht(byte out hum)
read humidity from SHT, result in byte precision 1%RH SHT may only be switched on for 10% of the time because of self-heating so this measurement can only happen every 500ms
read_raw_temp_sht(byte out MSB, byte out LSB, byte out CRC)
read raw 14-bit temperature from SHT default value of resolution bit is 14 bit temperature SHT takes 320 ms for measurement @ 14 bits we will wait 400 ms SHT may only be switched on for 10% of the time because of self-heating so this measurement can only happen every two seconds!
16f876a | 16f876a_sht.jal |
Author | Stef Mientki, Copyright (C) 2005 Stef Mientki |
Adapted-by | Joep Suijs, Albert Faber |
Compiler | >=2.4g |
Hardware implementation of I2C (single) master. Define i2c pins like: alias i2c_scl is pin_c3 ; optional, but good habit ;) alias i2c_scl_direction is pin_c3_direction alias i2c_sda is pin_c4 ; optional, but good habit ;) alias i2c_sda_direction is pin_c4_direction const word _i2c_bus_speed = 1 ; * 100kHz const bit _i2c_level = true ; i2c levels (not SMB)
No dependency found
const _i2c_100khz = (target_clock / (4 * 100_000)) - 1
const _i2c_400khz = (target_clock / (4 * 400_000)) - 1
const _i2c_1mhz = (target_clock / (4 * 1000_000)) - 1
const _i2c_100khz = (target_clock / (4 * 100_000)) - 1
some constants needed for the baudrate generator
const _i2c_400khz = (target_clock / (4 * 400_000)) - 1
No documentation found
const _i2c_1mhz = (target_clock / (4 * 1000_000)) - 1
No documentation found
i2c_restart()
i2c_restart - Sends Restart bit and waits untill finished
i2c_initialize()
if the device has changed, change the speed if necessary
i2c_stop()
i2c_stop - Sends Stop bit and waits until finished
i2c_start()
i2c_start - Sends Start bit and waits untill finished
i2c_receive_byte(bit in ACK ) return byte
i2c_receive_byte - start receiving of a byte and waits till finished if param ACK is true, the byte is acknowledged and next bytes can be received. if param ACK is false, the byte is nacked and a stop *should be* sent. note: this behavior is inverted from the line level and orignal library, but consistent with the i2c_software library.
i2c_transmit_byte(byte in data) return bit
i2c_transmit_byte -
16f877 | 16f877_i2c_hw_l0.jal |
16f877 | 16f877_i2c_hw_l1.jal |
16f877a | 16f877a_i2c_hw_l0.jal |
16f877a | 16f877a_i2c_hw_l1.jal |
18f14k50 | 18f14k50_i2c_hw_l1.jal |
18f14k50 | 18f14k50_i2c_hw_l0.jal |
18f25k22 | 18f25k22_i2c_hw_master_echo.jal |
18f4550 | 18f4550_i2c_hw_l1.jal |
18f4550 | 18f4550_i2c_hw_l0.jal |
Author | Sebastien Lelong, Copyright (c) 2008-2009, all rights reserved. |
Adapted-by | Joep Suijs, Albert Faber |
Compiler | >=2.4i |
Common and useful functions and procedure to implement an I2C slave
No dependency found
var byte tmpstat ; this contains the last sspstat value, on which the user functions are
No documentation found
i2c_hw_slave_init(byte in height_bits_icaddress)
setup an i2c slave, with low address (not high addresses coded with 10-bits) The passed address must be 8-bits long: it's a 7-bits address + the 8th R/W bit A global "i2c_enable_start_stop_interrupts" constant can be defined to so interrupts are generated on Start/Stop signals. /!\ careful: calling this procedure will enable interrupts (global, peripherals and i2c)
i2c_hw_slave_write_i2c(byte in what)
write a byte to i2c bus
i2c_hw_slave_read_i2c() return byte
read a byte from i2c buffer and returns it
Author | Sebastien Lelong, Joep Suijs, Copyright (c) 2008-2009, all rights reserved. |
Adapted-by | Joep Suijs, Albert Faber |
Compiler | >=2.4i |
this library provides an ISR to implement a stateful i2c hardware slave. This is a jalv2 implementation of Microchip Application Note AN734. According to AN734, there are 5 possible i2c states. During ISR, each of this states are detected. This ISR provides a standard skeleton to implement an i2c hardware slaves, while client code must implement several callbacks the ISR is expecting to call while processing states. Here there are: - procedure i2c_hw_slave_on_state_1(byte in _trash): called when i2c address matches (master starts a talk) - procedure i2c_hw_slave_on_state_2(byte in rcv): called when master is writing a byte. Slave is thus receiving this byte. This callback takes this bytes as argument - procedure i2c_hw_slave_on_state_3(): called when master wants to read a byte from slave. Thus, slave should send a byte (for instance, using i2c_hw_slave_write_i2c from i2c_hw_slave.jal library) - procedure i2c_hw_slave_on_state_4(): called when master still wants to read a byte from slave. That is, master required to read (state 3) and now still want to read a byte - procedure i2c_hw_slave_on_state_5(): called when master does not want to talk to slave anymore usually a good place to reset data or slave's logic - procedure i2c_hw_slave_on_error(): called when something wrong happens. You can do what you want in this case, like resetting the PIC, log some information using usart, ... => called any cases other than states 1, 2, 3, 4 or 5
- AN734: http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011798
No dependency found
i2c_hw_slave_isr_handler()
i2c ISR handler. Detects states a call appropriate procedures
Author | Sebastien Lelong, Joep Suijs, Copyright (c) 2008-2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4i |
this library provides an message interface to i2c hardware slave. It relies on the jalv2 implementation of Microchip Application Note AN734. The user needs to supply a procedure to process the received message. Basically, this i2c slave waits for a full message to arrive. Then it calls the user procedure to process the message and (optional) prepare a response. Subsequently, this lib will pass the response data over to the master, if it wants to have them. See corresponding sample for more details.
- AN734: http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011798
var byte i2c_index
var bit i2c_datapresent
const bit i2c_enable_start_stop_interrupts = true
var byte i2c_buffer[I2C_BUFFER_SIZE]
i2c_hw_slave_on_stop()
i2c_hw_slave_on_state_4()
i2c_hw_slave_on_state_3()
i2c_hw_slave_on_error()
i2c_hw_slave_on_state_1(byte in _trash)
i2c_hw_slave_on_start()
i2c_call_process_message()
i2c_hw_slave_on_state_2(byte in rcv)
i2c_hw_slave_on_state_5()
var byte i2c_index
vars
var bit i2c_datapresent
datapresent flag
const bit i2c_enable_start_stop_interrupts = true
No documentation found
var byte i2c_buffer[I2C_BUFFER_SIZE]
No documentation found
i2c_hw_slave_on_stop()
No documentation found
i2c_hw_slave_on_state_4()
this callback is used when master, after having read something, still wants to read and get data from us.
i2c_hw_slave_on_state_3()
this callback is used when master wants to read something from us. It should use i2c_hw_slave_write() to send something
i2c_hw_slave_on_error()
this callback is used when something wrong happened during communication between master and us
i2c_hw_slave_on_state_1(byte in _trash)
this callback is used when master wants to talk to us and our i2c address has been recognized
i2c_hw_slave_on_start()
No documentation found
i2c_call_process_message()
No documentation found
i2c_hw_slave_on_state_2(byte in rcv)
This callback is used when master sends a data byte
i2c_hw_slave_on_state_5()
this callback is used when master does not want to talk with us anymore... This is an appropriate place to reset data for instance
Author | Joep Suijs, Copyright (C) 2008 Joep Suijs |
Adapted-by | |
Compiler | >=2.4g |
Level1 implementation of I2C (single) master.
No dependency found
i2c_receive_byteaddr(byte in i2c_address, byte in addr, byte in i2c_rx_count) return bit
i2c_send_receive(byte in i2c_address, byte in i2c_tx_count, byte in i2c_rx_count) return bit
i2c_receive_wordaddr(byte in i2c_address, word in addr, byte in i2c_rx_count) return bit
i2c_receive_byteaddr(byte in i2c_address, byte in addr, byte in i2c_rx_count) return bit
i2c_receive_byteaddr - send a byte address and receive a string from an i2c slave
i2c_send_receive(byte in i2c_address, byte in i2c_tx_count, byte in i2c_rx_count) return bit
i2c_send_receive - send a string to an i2c slave and receive bytes back This funtion uses two global i2c buffers, one for transmit (tx) and one for receive (rx). The address of the slave (higher 7 bits), number of bytes to transmit and number of bytes to receive are parameters. returns true if all went well.
i2c_receive_wordaddr(byte in i2c_address, word in addr, byte in i2c_rx_count) return bit
i2c_receive_wordaddr - send a word address and receive a string from an i2c slave
Author | Wouter van Ooijen, Copyright (C) 1998, 1999 Wouter van Ooijen |
Adapted-by | Joep Suijs. |
Compiler | >=2.4g |
Software implementation of I2C (single) master. Define i2c pins like: alias i2c_scl is pin_c3 alias i2c_scl_direction is pin_c3_direction alias i2c_sda is pin_c4 alias i2c_sda_direction is pin_c4_direction const word _i2c_bus_speed = 1 ; * 100kHz
i2c_initialize()
i2c_initialize - initialize the software i2c bus The output latch values are always low, the lines are switched open-collector fashion by manipulating the direction registers.
i2c_stop()
i2c_stop - output a stop condition
i2c_start()
i2c_start - output a start condition
i2c_restart()
i2c_restart - output a (re)start condition A restart is a start without a previous stop. This procedure is provided as part of the API to maintain compatibility with the i2c hardware master lib.
_i2c_bit_out(bit in x)
_i2c_bit_out- output a single bit (for internal use only)
_i2c_bit_in(bit out x)
_i2c_bit_in- input a single bit (for internal use only)
_i2c_wait()
_i2c_wait - wait for a change to settle (for internal use only) The delay is determined by i2c_bus_speed and is 1/4 of the cycle time. Given the delay resolution of 1 us and all actions required by i2c_software routines, the actual bus speed will be lower then the configured maximum.
i2c_transmit_byte( byte in x ) return bit
i2c_transmit_byte - output one byte return true = okay, false = no ack received
i2c_receive_byte(bit in ack) return byte
i2c_receive_byte - read one byte The ACK flag indicated if the byte read must be acked. In general, all bytes read by the master are acked, except the last one. Failing to NACK the last byte read will give unpredictable results. (Often it will provide repeatable sequences, where one out of 2 to 4 of the reads from a specific device is correct. You are warned!)
Author | Sebastien Lelong, Copyright (c) 2008-2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4k |
this lib is able to handle the GP2D02 lib, reading distance measure with this IR Ranger. You can either use the read procedure, or access the pseudo-variable to retrieve distance measures. When defining pins the ranger is connected to to, it's important to set them as "volatile" (level will go low/high within function call) See sample(s) for more.
- datasheet: http://www.datasheetcatalog.org/datasheet/Sharp/mXvryzu.pdf
reading a distance can take quite a long time, approx. 74ms. See datasheet for more, but you should remember this while using this IR ranger
gp2d02_read_pins(volatile bit out pin_vin, volatile bit in pin_vout) return byte
No documentation found
16f88 | 16f88_ir_ranger_gp2d02.jal |
Author | Wouter van Ooijen, Copyright (c) 1998, all rights reserved. |
Adapted-by | Joep Suijs, Rob Hamerling |
Compiler | >=2.4 |
- ASCII text character constant definitions - case conversion procedures toupper and tolower use of toupper var byte char = "b" -- assign lower case "b" to char toupper(char) -- char now contains "B"
No dependency found
const byte ASCII_SUB = 26
const byte ASCII_DC4 = 20
const byte ASCII_ETB = 23
const byte ASCII_NAK = 21
const byte ASCII_US = 31
const byte ASCII_SYN = 22
const byte ASCII_RS = 30
const byte ASCII_BS = 08
const byte ASCII_EM = 25
const byte ASCII_EOT = 04
const byte ASCII_DLE = 16
const byte ASCII_LF = 10
const byte ASCII_DC2 = 18
const byte ASCII_ETX = 03
const byte ASCII_ESC = 27
const byte ASCII_CAN = 24
const byte ASCII_SOH = 01
const byte ASCII_ACK = 06
const byte ASCII_HT = 09
const byte ASCII_NULL = 00
const byte ASCII_GS = 29
const byte ASCII_BEL = 07
const byte ASCII_DC1 = 17
const byte ASCII_DC3 = 19
const byte ASCII_SO = 14
const byte ASCII_FF = 12
const byte ASCII_SP = 32
const byte ASCII_ENQ = 05
const byte ASCII_SI = 15
const byte ASCII_CR = 13
const byte ASCII_VT = 11
const byte ASCII_STX = 02
const byte ASCII_DEL = 127
const byte ASCII_FS = 28
const byte ASCII_SUB = 26
No documentation found
const byte ASCII_DC4 = 20
No documentation found
const byte ASCII_ETB = 23
No documentation found
const byte ASCII_NAK = 21
No documentation found
const byte ASCII_US = 31
No documentation found
const byte ASCII_SYN = 22
No documentation found
const byte ASCII_RS = 30
No documentation found
const byte ASCII_BS = 08
No documentation found
const byte ASCII_EM = 25
No documentation found
const byte ASCII_EOT = 04
No documentation found
const byte ASCII_DLE = 16
No documentation found
const byte ASCII_LF = 10
No documentation found
const byte ASCII_DC2 = 18
No documentation found
const byte ASCII_ETX = 03
No documentation found
const byte ASCII_ESC = 27
No documentation found
const byte ASCII_CAN = 24
No documentation found
const byte ASCII_SOH = 01
No documentation found
const byte ASCII_ACK = 06
No documentation found
const byte ASCII_HT = 09
No documentation found
const byte ASCII_NULL = 00
No documentation found
const byte ASCII_GS = 29
No documentation found
const byte ASCII_BEL = 07
No documentation found
const byte ASCII_DC1 = 17
No documentation found
const byte ASCII_DC3 = 19
No documentation found
const byte ASCII_SO = 14
No documentation found
const byte ASCII_FF = 12
No documentation found
const byte ASCII_SP = 32
No documentation found
const byte ASCII_ENQ = 05
No documentation found
const byte ASCII_SI = 15
No documentation found
const byte ASCII_CR = 13
No documentation found
const byte ASCII_VT = 11
No documentation found
const byte ASCII_STX = 02
No documentation found
const byte ASCII_DEL = 127
No documentation found
const byte ASCII_FS = 28
No documentation found
toupper(byte in out char)
toupper - convert byte to upper case
tolower(byte in out char)
tolower - convert byte to lower case
Author | Javier Martínez, Copyright (c) 2003, all rights reserved. |
Adapted-by | Eur van Andel, eur@fiwihex.nl, Joep Suijs, Rob Hamerling |
Compiler | >=2.4g |
This library is used to scan a 4x3 or 4x4 keyboard. To use it, you need to define three variables: keydrive is the half port (_high or _low) with the cols connected. keydrive_direction is the related direction register. keyscan is the half port (_high or _low) with the rows connected. Example: var volatile byte keyscan is porta_low -- rows of keyboard var volatile byte keydrive is portb_low -- columns of keyboard var volatile byte keydrive_direction is portb_low_direction include keyboard Note: if you don't want keyboard.jal change the direction of your pins, make sure all keydrive pins are set to output before you call the library and define: var volatile byte keydrive_direction is keydrive The library has two functions to read the keyboard: getkey() returns the key pressed. getkey_once() returns a pressed key only once (and 'none', 0x10 until the next key is pressed) Hardware setup: connect the keyboard rows to a half port (higher or lower 4 bits of a port) and connect the cols to a half port. Put a pull-down resistor (10k - 47k) on each row pin. Adaptation: soldering your wires in the right order is a lot harder than you think. Make sure you keep the rows and cols together and connect them to right port. You could either adapt your wiring to match the default configuration or reconfigure the library by defining the next 8 constants before you include keyboard.jal, like: const row1 = 0b0000_0100 const row2 = 0b0000_0001 const row3 = 0b0000_0010 const row4 = 0b0000_1000 const col1 = 0b0000_1000 const col2 = 0b0000_0010 const col3 = 0b0000_0100 const col4 = 0b0000_0001 Connect the keyboard and press the buttons. Adapt the row and column constants so pressing the buttons give the right result. Note: you need to specify all 8 constants, even when you have a 4x3 keyboard. In this case you can specify: const col4 = 0b0000_0000 keyboard map (4x4, col4 is left out with 4x3 keyboard) 1 2 3 C row 1 4 5 6 D row 2 7 8 9 E row 3 * 0 # F row 4 col 1 2 3 4
[RobH] Added a 1 microsecond delay after changing keydrive to obtain reliable results with oscillator frequencies of 8 MHz and higher
No dependency found
var byte scan0, scan1, scan2, scan3
No documentation found
var byte lastkey = 0xff
No documentation found
getkey() return byte
getkey - return the key pressed (until it is released) return: 0 .. 9 numeric key pressed 0..9 10 * (or A) 11 # (or B) 12 .. 15 C, D, E, F 16 no key pressed. 17 error (more then one key pressed)
getkey_once() return byte
getkey_once - return the value of a key pressed only once returns: see getkey()
16f876a | 16f876a_keyboard_lcd.jal |
16f877 | 16f877_keyboard.jal |
16f877a | 16f877a_keyboard_lcd.jal |
16f877a | 16f877a_keyboard.jal |
18f26j11 | 18f26j11_rtcc_hw_kbd_lcd.jal |
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4l |
This is library for creating an array that take up more then 256 bytes memory. Tested on 18F devices only.
Supports byte array with up to 2048 entries Supports word array with up to 1024 entries Supports dword array with up to 512 entries Creates an array named large_array_1 Use "alias new_array_name is large_array_1" to rename the array Small sample of how this lib was created at bottom of lib.
No dependency found
18f452 | 18f452_large_array.jal |
18f4525 | 18f4525_large_array.jal |
18f4550 | 18f4550_large_array.jal |
18f4620 | 18f4620_large_array.jal |
18f67j50 | 18f67j50_large_array.jal |
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4l |
This is library for creating an array that take up more then 256 bytes memory. Tested on 18F devices only.
Supports byte array with up to 2048 entries Supports word array with up to 1024 entries Supports dword array with up to 512 entries Creates an array named large_array_2 Use "alias new_array_name is large_array_2" to rename the array Small sample of how this lib was created at bottom of lib.
No dependency found
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4l |
This is library for creating an array that take up more then 256 bytes memory. Tested on 18F devices only.
Supports byte array with up to 2048 entries Supports word array with up to 1024 entries Supports dword array with up to 512 entries Creates an array named large_array_3 Use "alias new_array_name is large_array_3" to rename the array Small sample of how this lib was created at bottom of lib.
No dependency found
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4l |
This is library for creating an array that take up more then 256 bytes memory. Tested on 18F devices only.
Supports byte array with up to 2048 entries Supports word array with up to 1024 entries Supports dword array with up to 512 entries Creates an array named large_array_4 Use "alias new_array_name is large_array_4" to rename the array Small sample of how this lib was created at bottom of lib.
No dependency found
Author | Joep Suijs, Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4g |
Provides standard interface to backlight of (directly connected) lcd. First, setup the pin for the backlight: var volatile bit lcd_bl is pin_b0 pin_b0_direction = output If the backlight line is inverted (that is low output turn the backlight on), you must define: const bit lcd_bl_inverted = true If you want digital backlight (on or off), then you can include this library. But if you want variable backlight (256 steps from off to on), the pin above must be a pwm (ccp) output pin. And you have to tell the library, which pwm: const byte lcd_backlight_pwm = 1 now include the library & init it: include lcd_backlight pwm_backlight_init()
No dependency found
pwm_backlight_init()
pwm_backlight_init - init backlight functions
lcd_backlight(bit in onoff)
lcd_backlight - turn backlite on/off
lcd_backlight_variable(byte in value)
lcd_backlight_variable - set backlight level (0 =off, 255 = max on)
16f648a | 16f648a_backlight.jal |
16f877 | 16f877_backlight.jal |
16f877a | 16f877a_backlight.jal |
16f88 | 16f88_backlight.jal |
Author | Richard Zengerink, Copyright (c) 2008, all rights reserved |
Adapted-by | |
Compiler | =2.4 |
Simple interface for DOG-M (st7036) alphanumeric LCD screens. Screens can range from 1x8 (1 lines, 8 chars), 2x16 and 3x16. Uses 4 bit wide datapath + 2 handshake lines (total 6 PIC pins). Expects: - 2 pins for handshake: 'lcd_rs' and 'lcd_en' - 1 port nibble for data: 'lcd_dataport' * Directions for use of this library in application programs (in this sequence): 1. Declare the following constants: const byte LCD_ROWS = 2 -- 1, 2 or 3 lines const byte LCD_CHARS = 16 -- 8, 16 chars per line and variables (aliases): var byte lcd_dataport is portA_low -- 4 data pins var bit lcd_en is pin_A4 -- trigger var bit lcd_rs is pin_A5 -- cmd/data select 2. Include this library. and somewhere before actually using the lcd: 3. Set the chosen LCD dataport and handshake pins to output: portA_low_direction = all_output pin_A4_direction = output pin_A5_direction = output 4. Call lcd_init() to initialize the lcd controller. Above is an example for a 2x16 LCD: Bits 0..3 of portA are used for data, pins 4 and 5 of portA are used for handshake. Any other available nibble and handshake pins could be used (provided these are configurable for output).
const lcd_normal_delay = 3
delay's necessary for initialisation and some commands
const lcd_long_delay = 120
delay in 10 usec units = 1,2mS
lcd_init()
Initialize display in 1 and 2 or 3 line, display on, no cursor shown an cursor moves to the right.
_lcd_write_data(byte in value)
sends data byte in value to LCD
__lcd_write(byte in value)
Send byte to the LCD as 2 nibbles (most significant nibble first) and automatically set the cursor one position right.
_lcd_write_command(byte in value)
sends command byte in value to LCD
Author | Richard Zengerink, Copyright (c) 2008, all rights reserved |
Adapted-by | |
Compiler | =2.4 |
Simple interface for DOG-M (st7036) alphanumeric LCD screens. Screens can range from 1x8 (1 lines, 8 chars), 2x16 and 3x16. Uses 8 bit wide datapath + 2 handshake lines (total 10 PIC pins). Expects: - 2 pins for handshake: 'lcd_rs' and 'lcd_en' - 1 port for data: 'lcd_dataport' * Directions for use of this library in application programs (in this sequence): 1. Declare the following constants: const byte LCD_ROWS = 2 -- 1, 2 or 3 lines const byte LCD_CHARS = 16 -- 8, 16 chars per line and variables (aliases): var byte lcd_dataport is portA -- 8 data pins var bit lcd_en is pin_b0 -- trigger var bit lcd_rs is pin_b1 -- cmd/data select 2. Include this library. and somewhere before actually using the lcd: 3. Set the chosen LCD dataport and handshake pins to output: portA_direction = all_output pin_b0_direction = output pin_b0_direction = output 4. Call lcd_init() to initialize the lcd controller. Above is an example for a 2x16 LCD: portA are is used for data, pins 0 and 1 of portB are used for handshake. Any other available port and handshake pins could be used (provided these are configurable for output).
const lcd_normal_delay = 3
delay's necessary for initialisation and some commands
const lcd_long_delay = 120
delay in 10 usec units = 1,2mS
lcd_init()
Initialize display in 1 and 2 or 3 line, display on, no cursor shown an cursor moves to the right.
_lcd_write(byte in value)
Send byte to the LCD and automatically set the cursor one position right.
_lcd_write_data(byte in value)
sends data byte in value to LCD for slow commands an extra delay should be added --
_lcd_write_command(byte in value)
sends command byte in value to LCD for slow commands an extra delay should be added
Author | Richard Zengerink, Copyright (c) 2008, all rights reserved |
Adapted-by | |
Compiler | =2.4 |
Simple interface for DOG-M (st7036) alphanumeric LCD screens. Screens can range from 1x8 (1 lines, 8 chars), 2x16 and 3x16. Uses spi interface SI (data line), CLK (clock) RS (register select) and if necesery CSB (chip select) (total 4 PIC pins max.). Expects: - 1 pin for data: 'lcd_data' - 1 pin for clock: 'lcd_clk' - 1 pin for register/data select: 'lcd_rs' - 1 pin for Chip Select 'lcd_csb' (if necesery, or CSB to gnd on lcd) - 1 var bit named not_connected to assign to lcd_csb if this pin is connected to ground. Directions for use of this library in application programs (in this sequence): 1. Declare the following constants: const byte LCD_ROWS = 2 -- 1, 2 or 3 lines const byte LCD_CHARS = 16 -- 8, or 16 chars per line and variables (aliases): var bit not_connected var bit lcd_data is pin_A0 -- 1 data pin var bit lcd_clk is pin_A1 -- 1 data pin var bit lcd_rs is pin_A2 -- 1 data pin var bit lcd_csb is pin_A3 -- 1 data pin or if csb is connected to gnd: var bit lcd_csb is not_connected 2. Include this library. and somewhere before actually using the lcd: 3. Set the chosen LCD data and control pins to output: portA_low_direction = all_output (in above case this is OK) OR assign each pin seperatly (when not every pin is on the same port): pin_A0_direction = output (each pin separately assigned) pin_A1_direction = output pin_b0_direction = output pin_b1_direction = output 4. Call lcd_init() to initialize the lcd controller. Above is an example for a 2x16 LCD: Available functions for application programs: _lcd_write() ends byte from value to register of the lcd and shift cursor position 1 right _lcd_write_data( ) write data to lcd using _lcd_write( ) lcd_rs high _lcd_write_data( ) write command to lcd using _lcd_write( ) lcd_rs low lcd_init() initialize the LCD controller
const lcd_normal_delay = 3
delay's necessary for initialisation and some commands
const lcd_long_delay = 120
delay in 10 usec units = 1,2mS
lcd_init()
Initialize display in 1 and 2 or 3 line, display on, no cursor shown an cursor moves to the right.
_lcd_write(byte in value)
sends byte from value to register of the lcd (this procedure is only used inside this file)
_lcd_write_data(byte in value)
sends data byte in value to LCD for slow commands an extra delay should be added --
_lcd_write_command(byte in value)
sends command byte in value to LCD for slow commands an extra delay should be added
Author | Joep Suijs, Copyright (c) 2009-2010, all rights reserved. |
Adapted-by | |
Compiler | >=2.4i |
this library provides a i2c star burst display driver The dm0822a is a star burst display driver with an i2c interface. To use this library: - setup i2c comms to the display - include this libraray and call dsm_init() Now you can use the display. A char assigned to dsm_data like: dsm_data = "A" is displayed on the next free location. And with dsm_data = ASCII_CR you start printing at the first location again. The indicator fields of the display can be switched on with dsm_set_indicator(DSM_I1) and turned off with dsm_clear_indicator(DSM_I1) The two procedures above support the next constants: DSM_1 : channel 1 indication DSM_2 : channel 2 indication DSM_3 : channel 3 indication DSM_4 : channel 4 indication DSM_5 : channel 5 indication DSM_6 : channel 6 indication DSM_I1 : left signal indication DSM_I2 : central signal indication DSM_I3 : right signal indication DSM_RDS : rds indicator DSM_TP : tp indication DSM_TA : ta indication DSM_OO : stereo indication DSM_FM : fm indication DSM_DOT : decimal point Multiple of these constants can be OR-ed together to one parameter
based on C program of Michael Dworkin Info on the display at http://hobbyelektronik.org/VB/LCD/DS/index.htm
No dependency found
const DSM_4 = 0x0800 ; channel 4 indication
const DSM_DOT = 0x0010 ; decimal point
const DSM_TA = 0x0040 ; ta indication
var byte dsm_pos = 0
const DSM_3 = 0x0200 ; channel 3 indication
const DSM_I1 = 0x1000 ; left signal indication
var word dsm_indicator_cache = 0
const DSM_TP = 0x0020 ; tp indication
const DSM_2 = 0x0400 ; channel 2 indication
const DSM_FM = 0x4000 ; fm indication
const DSM_6 = 0x2000 ; channel 6 indication
const byte dsm_tab[] =
const DSM_I3 = 0x0004 ; right signal indication
const DSM_5 = 0x8000 ; channel 5 indication
const DSM_I2 = 0x0001 ; central signal indication
const DSM_RDS = 0x0002 ; rds indicator
const DSM_OO = 0x8000 ; stereo indication
const DSM_1 = 0x0100 ; channel 1 indication
dsm_clear_indicator(word in data)
dsm_init()
dsm_data'put(byte in data)
dsm_set_indicator(word in data)
dsm_out(byte in pos, byte in a)
const DSM_4 = 0x0800 ; channel 4 indication
No documentation found
const DSM_DOT = 0x0010 ; decimal point
No documentation found
const DSM_TA = 0x0040 ; ta indication
No documentation found
var byte dsm_pos = 0
No documentation found
const DSM_3 = 0x0200 ; channel 3 indication
No documentation found
const DSM_I1 = 0x1000 ; left signal indication
No documentation found
var word dsm_indicator_cache = 0
No documentation found
const DSM_TP = 0x0020 ; tp indication
No documentation found
const DSM_2 = 0x0400 ; channel 2 indication
No documentation found
const DSM_FM = 0x4000 ; fm indication
No documentation found
const DSM_6 = 0x2000 ; channel 6 indication
No documentation found
const byte dsm_tab[] =
Translation table of ascci to two bytes, which indicate which segment have to be switched on.
const DSM_I3 = 0x0004 ; right signal indication
No documentation found
const DSM_5 = 0x8000 ; channel 5 indication
No documentation found
const DSM_I2 = 0x0001 ; central signal indication
No documentation found
const DSM_RDS = 0x0002 ; rds indicator
No documentation found
const DSM_OO = 0x8000 ; stereo indication
No documentation found
const DSM_1 = 0x0100 ; channel 1 indication
No documentation found
dsm_clear_indicator(word in data)
dsm_clear_indicator - set one or more indicators
dsm_init()
init & clear display
dsm_data'put(byte in data)
dsm_data'put - put a char at the next position CR or LF puts postion back to start.
dsm_set_indicator(word in data)
dsm_set_indicator - set one or more indicators
dsm_out(byte in pos, byte in a)
dsm_ou - Put a character at the designated position
_dsm_write_cache()
No documentation found
16f648a | 16f648a_lcd_dsm0822a.jal |
16f723 | 16f723_lcd_dsm0822a.jal |
16f73 | 16f73_lcd_dsm0822a.jal |
16f877 | 16f877_lcd_dsm0822a.jal |
16f877a | 16f877a_lcd_dsm0822a.jal |
16f88 | 16f88_lcd_dsm0822a.jal |
18f14k50 | 18f14k50_lcd_dsm0822a.jal |
18f2450 | 18f2450_lcd_dsm0822a.jal |
18f4550 | 18f4550_lcd_dsm0822a.jal |
Author | Rob Hamerling, Copyright (c) 2008..2009, all rights reserved. |
Adapted-by | Eur van Andel, Joep Suijs (refactoring),Richard Zengerink (lcd_init) |
Compiler | 2.4n |
Nibble interface for HD44780 compatible alphanumeric LCD screens. Uses 4 bits wide datapath + 2 handshake lines (total 6 PIC pins). Expects: 2 pins for handshake: 'lcd_rs' and 'lcd_en' and 1 port nibble for data: 'lcd_dataport' or 4 individual pins for data: 'lcd_d4' .. 'lcd_d7' . Note: a 'port nibble' (the lower or higher 4 bits of a port) gives faster and more compact code than 4 individual pins. . Directions for use of this library in application programs (in this sequence): 1. Declare the following constants: const byte LCD_ROWS = 2 -- 1, 2 or 4 lines const byte LCD_CHARS = 16 -- 8, 16 or 20 chars per line and aliases for handshake lines: alias lcd_rs is pin_A5 -- cmd/data select alias lcd_en is pin_A4 -- trigger and aliases for 4 data lines: alias lcd_dataport is portA_low -- 4 databits or alias lcd_d4 is pin_A3 -- lcd databit d4 alias lcd_d5 is pin_A1 -- lcd databit d5 alias lcd_d6 is pin_C0 -- lcd databit d6 alias lcd_d7 is pin_C2 -- lcd databit d7 . 2. Set the chosen LCD dataport and handshake pins to output: pin_A4_direction = output pin_A5_direction = output and the data port nibble to output: portA_low_direction = all_output or the 4 individual datapins to output: pin_A3_direction = output pin_A1_direction = output pin_C0_direction = output pin_C2_direction = output . 3. Include this library. . 4. Call lcd_init() to initialize the lcd controller. . Above is an example for a 2x16 LCD. . See hd_44780_common for the LCD API.
__lcd_write_nibble(byte in value)
_lcd_write_data(byte in value)
__lcd_write(byte in value)
_lcd_write_command(byte in value)
lcd_init()
Initialize LCD controller to 4-bits mode and default operational settings
__lcd_write_nibble(byte in value)
Sends low nibble into LCD Can be used for both commands and data (nibbles).
_lcd_write_data(byte in value)
Sends data byte into LCD
__lcd_write(byte in value)
Sends byte into LCD Wait cycle only required after lower nibble (not between nibbles).
_lcd_write_command(byte in value)
Sends command byte into LCD For slow commands an extra delay should be added.
Author | Rob Hamerling, Copyright (c) 2008..2009, all rights reserved. |
Adapted-by | Eur van Andel, Joep Suijs (refactoring),Richard Zengerink (lcd_init) |
Compiler | 2.4n |
Port interface for HD44780 compatible alphanumeric LCD screens. Uses 8 bits wide datapath + 2 handshake lines (total 10 PIC pins). Expects: 2 pins for handshake: 'lcd_rs' and 'lcd_en' and: 1 complete port for data: 'lcd_dataport' or 2 nibbles for data: 'lcd_dataport_low' and 'lcd_dataport_high' or 8 individual pins for data: lcd_dataline_d0 .. _d7 . note: a complete ports gives faster and more compact code then two port 'nibble'' (the lower or higher 4 bits of a port) which is on its turn faster than 8 individual pins. . Directions for use of this library in application programs (in this sequence): 1. Declare the following constants: const byte LCD_ROWS = 2 -- 1, 2 or 4 lines const byte LCD_CHARS = 16 -- 8, 16 or 20 chars per line and aliases for handshake lines: alias lcd_rs is pin_D2 -- cmd/data select alias lcd_en is pin_D3 -- trigger and aliases for 8 data lines: alias lcd_dataport is portF -- 8 databits or alias lcd_dataport_low is portD_high -- 4 low order databits alias lcd_dataport_high is portC_high -- 4 high order databits or alias lcd_d0 is pin_D0 -- lcd databit d0 alias lcd_d1 is pin_D1 -- lcd databit d1 alias lcd_d2 is pin_C6 -- lcd databit d2 alias lcd_d3 is pin_C7 -- lcd databit d3 alias lcd_d4 is pin_B0 -- lcd databit d4 alias lcd_d5 is pin_B1 -- lcd databit d5 alias lcd_d6 is pin_C0 -- lcd databit d6 alias lcd_d7 is pin_C2 -- lcd databit d7 . 2. Set the chosen LCD handshake pins to output: pin_D2_direction = output pin_D3_direction = output and the data port to output: portF_direction = ALL_OUTPUT or 2 data port nibbles to output: portD_high_direction = ALL_OUTPUT portC_high_direction = ALL_OUTPUT or 8 individual data pins to outout: pin_D0_direction = output pin_D1_direction = output pin_C6_direction = output pin_C7_direction = output pin_B0_direction = output pin_B1_direction = output pin_C0_direction = output pin_C2_direction = output . 3. Include this library. . 4. Call lcd_init() to initialize the lcd controller. . Above is an example for a 2x16 LCD. . See hd_44780_common for the LCD API.
lcd_init()
Initialize LCD controller to 8-bits mode and default operational settings
_lcd_write_data(byte in value)
Sends data byte into LCD
__lcd_write(byte in value)
Sends byte into the LCD Can be used for both commands and data.
_lcd_write_command(byte in value)
Sends command byte into LCD For slow commands an extra delay should be added
16f727 | 16f727_lcd_hd44780_8_1.jal |
16f727 | 16f727_lcd_hd44780_8_4.jal |
16f877a | 16f877a_lcd_hd44780_8_4.jal |
16f877a | 16f877a_lcd_hd44780_8_1.jal |
16f887 | 16f887_lcd_hd44780_8_1.jal |
16f887 | 16f887_lcd_hd44780_8_4.jal |
18f4685 | 18f4685_lcd_hd44780_8_4.jal |
18f4685 | 18f4685_lcd_hd44780_8_1.jal |
18f6310 | 18f6310_lcd_hd44780_8_1.jal |
18f6310 | 18f6310_lcd_hd44780_8_8.jal |
18f6310 | 18f6310_lcd_hd44780_8_4.jal |
Author | Richard Zengerink, Copyright (c) 2008..2011, all rights reserved. |
Adapted-by | Joep Suijs, Rob Hamerling |
Compiler | 2.4n |
Common API for HD44780 based LCD
No dependency found
const LCD_DISPLAY_SHIFT_LEFT = 0b_0001_1000
var volatile byte lcd_pos = 0
const LCD_DISPLAY_SHIFT_RIGHT = 0b_0001_1100
const LCD_RETURN_HOME = 0b_0000_0010
const LCD_CURSOR_SHIFT_R_VAL = 0b_0001_0100
const LCD_SET_DDRAM_ADDRESS = 0b_1000_0000
const LCD_SET_CGRAM_ADDRESS = 0b_0100_0000
const LCD_CLEAR_DISPLAY = 0b_0000_0001
const LCD_DISPLAY_ONOFF = 0b_0000_1000
const LCD_CURSOR_SHIFT_L_VAL = 0b_0001_0000
lcd_clear_screen()
lcd_clear_line(byte in line)
lcd_writechar(byte in data)
lcd_shift_right(byte in nr)
lcd_define(byte in pos, byte in str[])
lcd_cursor_blink_display(bit in cursor, bit in blink, bit in display)
lcd_cursor_shift_right(byte in nr)
lcd_shift_left(byte in nr)
lcd_clearscreen()
lcd_home()
lcd_write_char(byte in data)
lcd_cursor_position(byte in line, byte in pos)
lcd'put(byte in data)
lcd_cursor_shift_left(byte in nr)
lcd_progress(byte in line, byte in amount, byte in pattern)
const LCD_DISPLAY_SHIFT_LEFT = 0b_0001_1000
No documentation found
var volatile byte lcd_pos = 0
No documentation found
const LCD_DISPLAY_SHIFT_RIGHT = 0b_0001_1100
No documentation found
const LCD_RETURN_HOME = 0b_0000_0010
No documentation found
const LCD_CURSOR_SHIFT_R_VAL = 0b_0001_0100
No documentation found
const LCD_SET_DDRAM_ADDRESS = 0b_1000_0000
No documentation found
const LCD_SET_CGRAM_ADDRESS = 0b_0100_0000
No documentation found
const LCD_CLEAR_DISPLAY = 0b_0000_0001
constants to control the lcd
const LCD_DISPLAY_ONOFF = 0b_0000_1000
No documentation found
const LCD_CURSOR_SHIFT_L_VAL = 0b_0001_0000
No documentation found
lcd_clear_screen()
lcd_clear_screen - clears the LCD
lcd_clear_line(byte in line)
lcd_clear_line - clears the line "line" of the LCD
lcd_writechar(byte in data)
Deprecated
lcd_shift_right(byte in nr)
lcd_shift_right - shifts the complete display one position to the right
lcd_define(byte in pos, byte in str[])
lcd_define - Create a custom character The characters can be placed on position 0-7 of the character ram . pos: position of the character str[]: array containing the custom character . (0xFF is a common pattern)
lcd_cursor_blink_display(bit in cursor, bit in blink, bit in display)
lcd_cursor_blink_display - (re)sets cursor blink and puts display on/off . params: cursor: enable or disable the fixed underline cursor blink: enable or disable blinking of the block-cursor (so block blinking or off) display: enable or disable the whole display
lcd_cursor_shift_right(byte in nr)
lcd_cursor_shift_right - shifts cursor one position to the right
lcd_shift_left(byte in nr)
lcd_shift_left - shifts the complete display one position to the left
lcd_clearscreen()
Deprecated
lcd_home()
lcd_home - cursor returns home(line 0, position 0)
lcd_write_char(byte in data)
lcd_write_char - write one char to LCD
lcd_cursor_position(byte in line, byte in pos)
lcd_cursor_position - Specify row and column (0-based) . About cursor positions: the LCDs are internally 2x40 char devices. The first line starts at offset 0, the second line at offset 64 (0x40). With 4 line devices the third and fourth line are addressed as extensions of the first and second line by adding an offset. For a 4x20 line device the offset is 20, for a 4x16 line display the offset is 16 or 20. Declare the constant LCD_CHARS as appropriate for your screen (you may have to specify 20 even if your display has only 16 chars!). . Note: Some 1x16 LCDs are implemented as 2x8 line LCDs, which means that the second half of the line has to be handled as a second line.
lcd'put(byte in data)
lcd'put - write one char to screen (pseudo var, enables streams)
lcd_cursor_shift_left(byte in nr)
lcd_cursor_shift_left - shifts cursor one position to the left
lcd_progress(byte in line, byte in amount, byte in pattern)
lcd_progress- Displays a progress bar The progress bar starts at position 0 of a line. line: line on which progress bar is displayed amount: number of bar chars that are displayed (0xFF is a common pattern)
_lcd_restore_cursor()
_lcd_restore_cursor - sets the cursor to the position in the shadow register (this routine is only used inside this file)
_lcd_line2index(byte in line) return byte
_lcd_line2index - internal function - calculate index from line number
Author | Joep Suijs, Copyright (c) 2008..2009, all rights reserved. |
Adapted-by | Richard Zengerink (lcd_init) |
Compiler | >=2.4g |
Software serial interface for HD44780 compatible alphanumeric LCD screens. -- Directions for use of this library in application programs (in this sequence): 1. Declare the following constants: const byte LCD_ROWS = 2 -- 1, 2 or 4 lines const byte LCD_CHARS = 16 -- 8, 16 or 20 chars per line and variables (aliases): var bit serial_sw_tx_pin is pin_d0 -- pin on which lcd is connected 2. Set the chosen LCD dataport and handshake pins to output: pin_d0_direction = output 3. Include this library. 4. Call lcd_init() to initialize the lcd controller. Above is an example for a 2x16 LCD, connected to pin d0 See hd_44780_common for the LCD API.
var bit serial_sw_rx_pin ; dummy to include lib; will be optimised away.
const bit serial_sw_invert = true ; normal (low active) serial comms
const serial_sw_baudrate = 57600
var bit lcd_rs_shadow
__lcd_write_nibble( byte in value )
__lcd_write( byte in value )
_lcd_write_command(byte in value)
_lcd_write_data(byte in value)
var bit serial_sw_rx_pin ; dummy to include lib; will be optimised away.
No documentation found
const bit serial_sw_invert = true ; normal (low active) serial comms
No documentation found
const serial_sw_baudrate = 57600
No documentation found
var bit lcd_rs_shadow
No documentation found
lcd_backlight(bit in onoff)
lcd_backlight - turn backlite on/off
lcd_init()
lcd_backlight_variable(byte in value)
lcd_backlight_variable - set backlight level
__lcd_write_nibble( byte in value )
sends low nibble from value to the LCD can be used for both commands and data (requires no wait cycli inbetween upper and lower nibble) (this routine is only used inside this file)
__lcd_write( byte in value )
sends byte from value to register of the LCD (this procedure is only used inside this file)
_lcd_write_command(byte in value)
sends command byte in value to LCD for slow commands an extra delay should be added
_lcd_write_data(byte in value)
sends data byte in value to LCD for slow commands an extra delay should be added
Author | Javier Martínez & Eur Van Andel Copyright (C) 2003-2009 All rights reserved |
Adapted-by | William Welch |
Compiler | 2.4 |
Sterm (Serial Terminal) is a protocol to write to an standard HD44780 LCD and read from a 4x4 matrix keyboard. It was developed for easy debugging of JAL programs. With Sterm and a single PIC pin you can do a lot of human interfacing, often to the point that nothing else is needed. Especially usefull for projects "beyond the PC", that have to work in the field.
var byte lastkey = 0xff
No documentation found
lcd_init()
Send reset to Terminal: Clear the LCD and makes a sw reset of the PIC.
_lcd_write_data( byte in data3 )
Send 'hd447804 data' command to Terminal:
_lcd_write_command( byte in instr )
Send 'hd447804 instruction' command to Terminal:
lcd_key'get() return byte
Send 'input keyboard' command to Terminal:
lcd_buflag() return byte
Send 'input buffer' command to Terminal:
getkey() return byte
getkey - return the key pressed (until it is released)
getkey_once() return byte
getkey_once - return the value of a key pressed only once
__term_byte( byte in command1 , byte in data1 ) return byte
No documentation found
16f819 | 16f819_mcp2515_can_monitor.jal |
16f819 | 16f819_ee25aa02e48_lcd.jal |
16f819 | 16f819_mcp2515_canid4_monitor.jal |
18f2585 | 18f2585_canid4_serial_adapter.jal |
18f2585 | 18f2585_can_serial_adapter.jal |
18f2585 | 18f2585_can_monitor.jal |
18f2585 | 18f2585_canid4_monitor.jal |
18f2620 | 18f2620_rtc_tmr3.jal |
18f4585 | 18f4585_canid4_monitor.jal |
Author | Rob Hamerling, Michael Watterson Copyright (c) 2009, all rights reserved. |
Adapted-by | Michael Watterson, Eur van Andel |
Compiler | 2.4l |
Collection of mathematical routines.
Several authors.
No dependency found
div_fixed(sword in a, sword in b) return sdword
mult_fixed(sword in a, sword in b) return sdword
abs16(sword in x) return word
byte_to_fixed(byte in int) return sword
sign32(sdword in x) return sbyte
round_fixed(sword in fixed_point) return sbyte
rsin8( sword in radius, sword in angle ) return sword
abs32(sdword in x) return dword
digits_word(word in valu)return byte
sqrt16(word in x) return byte
sign8(sbyte in x) return sbyte
mod_fixed(sword in a, sword in b) return sword
sqrt32(dword in x) return word
abs8(sbyte in x) return byte
sign16(sword in x) return sbyte
rcos8( sword in radius, sword in angle ) return sword
trunc_fixed(sword in fixed_point) return sbyte
const byte SINLOOKUP[] = {0, 3, 8, 12, 17, 21, 26, 30, 35, 39, 43, 48, 52, 57,
sin values scaled to (256 * 1.0) -1 for values above Zero (i.e. add one to lookup if using table directly for other than Zeroth Element) apart from zero, all values are 1 less than actual to allow storage in 1 byte each
polar_to_cartesian(sword in radius, sword in angle, sword out xpos, sword out ypos)
use to rotate angle of a line by calculating endpoints use to generate quadrature waves by changing angle at a fixed speed. if using all 360 degrees in one degree steps, then frequency is step rate / 360 Author: Michael Watterson
div_fixed(sword in a, sword in b) return sdword
No documentation found
mult_fixed(sword in a, sword in b) return sdword
unlike integer max is 128 * 128 *256 approx
abs16(sword in x) return word
No documentation found
byte_to_fixed(byte in int) return sword
fixed point math is 8 bits for decimal in this library. approx two decimal paces, the part after "point" is 0 to 255 sword fixed point numbers are thus -127.00 to +127.00 approx if you want bigger numbers replace all swords by sdwords and sdwords by sbyte*8 if the compiler can do the math still.
sign32(sdword in x) return sbyte
No documentation found
round_fixed(sword in fixed_point) return sbyte
No documentation found
rsin8( sword in radius, sword in angle ) return sword
works with fixed point numbers 256 = 1.0
abs32(sdword in x) return dword
No documentation found
digits_word(word in valu)return byte
No documentation found
sqrt16(word in x) return byte
Calculate the square root of an unsigned 16-bits integer Returns an 8-bits integer Original author: Kyle York
sign8(sbyte in x) return sbyte
No documentation found
mod_fixed(sword in a, sword in b) return sword
probably a better way to do this!
sqrt32(dword in x) return word
Calculate the square root of an unsigned 32-bits integer Returns a 16-bits integer Original author: Kyle York
abs8(sbyte in x) return byte
Author: Eur van Andel, eur@fiwihex.nl
sign16(sword in x) return sbyte
No documentation found
rcos8( sword in radius, sword in angle ) return sword
Author: Michael Watterson
trunc_fixed(sword in fixed_point) return sbyte
No documentation found
16f648a | 16f648a_sqrt.jal |
16f723 | 16f723_sqrt.jal |
16f73 | 16f73_sqrt.jal |
16f877 | 16f877_sqrt.jal |
16f877a | 16f877a_sqrt.jal |
16f88 | 16f88_sqrt.jal |
16f886 | 16f886_math.jal |
18f14k50 | 18f14k50_sqrt.jal |
18f2450 | 18f2450_sqrt.jal |
18f4550 | 18f4550_sqrt.jal |
Author | Eur van Andel, eur@fiwihex.nl Copyright (c) 2010 |
Adapted-by | William Welch |
Compiler | =2.4n |
this library works with the MCP3424 AD converter from Microchip with up to 18 bits accuracy Datasheet: DS22088B
No dependency found
mcp3424_set_channel(byte in address, byte in channel) return bit
mcp3424_get_18_status(byte in address, byte out status) return sdword
mcp3424_get_16(byte in address) return sword
mcp3424_get_18(byte in address) return sdword
mcp3424_set_gain(byte in address, byte in gain) return bit
mcp3424_get_16_status(byte in address, byte out status) return sword
mcp3424_set18bits(byte in address) return bit
mcp3424_millivolt(sdword in tcvalue, byte in gain) return sword
mcp3424_microvolt(sdword in tcvalue, byte in gain) return sdword
var byte mcp3424_config[8]
No documentation found
mcp3424_set_channel(byte in address, byte in channel) return bit
channel should be 1 .. 4, as per datasheet DS22088B page 18 if channel = 0, 1 is assumed. If channel is > 4, 4 is assumed
mcp3424_get_18_status(byte in address, byte out status) return sdword
get 18-bit adc reading, return status/config_reg read-back to caller
mcp3424_get_16(byte in address) return sword
get 16-bit adc reading, no status returned to caller. legacy routine.
mcp3424_get_18(byte in address) return sdword
get 18-bit adc reading, no status returned to caller. legacy routine.
mcp3424_set_gain(byte in address, byte in gain) return bit
gain should be 1, 2, 4, 8, as per datasheet DS22088B page 18 gain = 0,1 -> 1 / 2 -> 2, 3,4 -> 4 / 5..255 -> 8
mcp3424_get_16_status(byte in address, byte out status) return sword
get 16-bit adc reading, return status/config_reg read-back to caller
mcp3424_set18bits(byte in address) return bit
initialize mcp3424 for 18-bit samples and continuous conversion mode. NB: also sets G=1, channel=0. These may be modified by other functions (see below)
mcp3424_millivolt(sdword in tcvalue, byte in gain) return sword
gain should be 1, 2, 4, 8, as per datasheet DS22088B page 18 if gain = 0,1 -> 1 / 2 -> 2, 3,4 -> 4 / 5..255 -> 8 FIXME: this routine only handles 18-bit samples.
mcp3424_microvolt(sdword in tcvalue, byte in gain) return sdword
gain should be 1, 2, 4, 8, as per datasheet DS22088B page 18 if gain = 0,1 -> 1 / 2 -> 2, 3,4 -> 4 / 5..255 -> 8 FIXME: this routine only handles 18-bit samples.
Author | Eur van Andel, eur@fiwihex.nl Copyright (c) 2010 |
Adapted-by | William Welch |
Compiler | =2.4n |
this library works with the MCP9800 temperature sensor from microchip The MCP9800 can do 9 to 12 bit temperature measurement resolution in the 12bit mode, the LSb represents 1/16ºC only 12 bit routines are given here
No dependency found
mcp9800_centicelsius() return sword
mcp9800_set_12_bits_temperature() return bit
mcp9800_12bit() return sword
mcp9800_celsius() return sbyte
const byte mcp9800_addr = 0b1001_0000
read/write is done by i2c library
mcp9800_centicelsius() return sword
temperature, in degrees Celsius X 100, as a signed-word
mcp9800_set_12_bits_temperature() return bit
initialize the mcp9800 for 12-bit samples
mcp9800_12bit() return sword
return Celsius temperature in this format: Smmmmmmmmmmm.ffff
mcp9800_celsius() return sbyte
temperature, in degrees Celsius as a signed-byte
Author | Matthew Schinkel, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4m |
example usage of the sta015 mp3 decoder. plays .mp3 files from a fat32 formatted sd card or hard disk
http://www.st.com/stonline/books/pdf/docs/7042.pdf http://www.pjrc.com/mp3/sta013.html
No dependency found
const byte STA015_RIGHT_UP = 112
const byte STA015_MUTE = 103
const byte STA015_NO_MUTE = 104
const byte STA015_DUAL_CHANNEL = 2
const byte _STA015_RESET = 0x16
var byte sta015_left = 0
const byte STA015_STEREO = 0
var byte sta015_mode
const byte STA015_STOP_PLAY = 102
const byte STA015_BASE_UP = 108
const byte STA015_OSC_10 = 0
var byte _sta015_head_mid
const byte _STA015_MUTE = 0x14
const byte STA015_OSC_14_31818 = 2
const byte _STA015_TREBLE_ENHANCE = 0x7B
const byte STA015_TREBLE_DOWN = 109
const byte _STA015_DRB = 0x49
var byte _sta015_head_high
const byte STA015_READ_INFO = 115
const byte STA015_LEFT_UP = 114
const byte STA015_START_PLAY = 101
const byte _STA015_BASS_ENHANCE = 0x7C
const byte STA015_VOLUME_UP = 106
var sbyte sta015_base = 0
const byte STA015_OSC_14_7456 = 3
const byte STA015_RESET = 100
const byte _STA015_RUN = 0x72
var byte sta015_right = 0
const byte STA015_TREBLE_UP = 110
const byte STA015_BASE_DOWN = 107
const byte _STA015_DRA = 0x48
const byte STA015_RIGHT_DOWN = 111
const byte STA015_SINGLE_CHANNEL = 3
const byte _STA015_PLAY = 0x19
const byte STA015_OSC_20 = 1
var byte sta015_crystal
const byte STA015_LEFT_DOWN = 113
const byte _STA015_TONE_ATTEN = 0x7D
var word sta015_bitrate
var byte _sta015_head_low
var sbyte sta015_treble = 0
const byte STA015_VOLUME_DOWN = 105
const byte STA015_JOINT_STEREO = 1
var byte sta015_attenuation = STA015_DEFAULT_ATTENUATION
sta015_read_mp3_info()
sta015_read_register(byte in reg_address, byte out data)
sta015_init(byte in crystal_speed)
sta015_send_volume()
sta015_send(byte in data)
sta015_write_command(byte in command)
sta015_write_register(byte in reg_address, byte in data)
const byte STA015_RIGHT_UP = 112
Turn up the right speaker volume
const byte STA015_MUTE = 103
Mute (turn off volume but continue playing)
const byte STA015_NO_MUTE = 104
Turn off Mute (restore volume)
const byte STA015_DUAL_CHANNEL = 2
dual_channel
const byte _STA015_RESET = 0x16
register addresses
var byte sta015_left = 0
current left speaker volume
const byte STA015_STEREO = 0
stereo
var byte sta015_mode
sta015_mode will equal current playing mp3's mode after sta015_write_command(STA015_READ_INFO) as seen below. example: if sta015_mode == STA015_STEREO then
const byte STA015_STOP_PLAY = 102
Tell device to stop playing. Or just stop sending data
const byte STA015_BASE_UP = 108
Turn up base (low frequency sounds)
const byte STA015_OSC_10 = 0
oscillators for the init procedure
var byte _sta015_head_mid
holds some mp3 info
const byte _STA015_MUTE = 0x14
mute command register
const byte STA015_OSC_14_31818 = 2
14.31818 mhz crystal
const byte _STA015_TREBLE_ENHANCE = 0x7B
treble enhance register
const byte STA015_TREBLE_DOWN = 109
Turn down treble (high frequency sounds)
const byte _STA015_DRB = 0x49
right volume register
var byte _sta015_head_high
holds some mp3 info
const byte STA015_READ_INFO = 115
Get mp3 bitrate and mode(mono/stereo) with sta015_read_mp3_info() command
const byte STA015_LEFT_UP = 114
Turn up the left speaker volume
const byte STA015_START_PLAY = 101
Tell the device to start playing. You need to send data after
const byte _STA015_BASS_ENHANCE = 0x7C
base enhance register
const byte STA015_VOLUME_UP = 106
Turn up the volume (less attenuation)
var sbyte sta015_base = 0
current base volume
const byte STA015_OSC_14_7456 = 3
14.7456 mhz crystal
const byte STA015_RESET = 100
send one of the following constants to the sta015_write_command procedure
const byte _STA015_RUN = 0x72
run command register
var byte sta015_right = 0
current right speaker volume
const byte STA015_TREBLE_UP = 110
Turn up the treble (high frequency sounds)
const byte STA015_BASE_DOWN = 107
Turn down base (low frequency sounds)
const byte _STA015_DRA = 0x48
left volume register
const byte STA015_RIGHT_DOWN = 111
Turn down the right speaker volume
const byte STA015_SINGLE_CHANNEL = 3
single_channel (mono)
const byte _STA015_PLAY = 0x19
play command register
const byte STA015_OSC_20 = 1
20 mhz crystal
var byte sta015_crystal
holds the crystal value chosen after init
const byte STA015_LEFT_DOWN = 113
Turn down the left speaker volume
const byte _STA015_TONE_ATTEN = 0x7D
tone attenuation register
var word sta015_bitrate
holds current playing mp3's bitrate or quality in kbps after sta015_write_command(STA015_READ_INFO)
var byte _sta015_head_low
holds some mp3 info
var sbyte sta015_treble = 0
current treble volume
const byte STA015_VOLUME_DOWN = 105
Turn down the volume (more attenuation)
const byte STA015_JOINT_STEREO = 1
joint stereo (intensity_stereo and/or ms_stereo)
var byte sta015_attenuation = STA015_DEFAULT_ATTENUATION
volume control vars, read only. use sta015_write_command() procedure to change volume
sta015_read_mp3_info()
No documentation found
sta015_read_register(byte in reg_address, byte out data)
No documentation found
sta015_init(byte in crystal_speed)
No documentation found
sta015_send_volume()
send the current volume to the serial port
sta015_send(byte in data)
No documentation found
sta015_write_command(byte in command)
No documentation found
sta015_write_register(byte in reg_address, byte in data)
No documentation found
Author | Matthew Schinkel, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4m |
example usage of the vs1053 mp3 decoder. plays .mp3 files from a fat32 formatted sd card. Full control of play speed, volume, right/left speaker, bass, treble, mute. Also plays Ogg Vorbis/AAC/WMA/MIDI
VLSI Solutions Datasheet - www.vlsi.fi/fileadmin/datasheets/vlsi/vs1053.pdf
vs1053 uses SPI mode 0,0 must use 12.288mhz crystal for vs1053b
No dependency found
var bit vs_pin_gpio3_data at vs_port_gpio_data : 3
var byte vs_current_file_type[4]
var byte _vs_play_speed_data = 1
const byte VS_REG_DECODE_TIME = 0x04
const byte _vs_table_layer2_id3[15] = {0,32,48,56,64,80,96,112,128,160,192,224,256,320,384}
var bit vs_pin_gpio7_direction_data at vs_port_gpio_direction_data : 7
var bit vs_pin_gpio4_direction_data at vs_port_gpio_direction_data : 4
const byte VS_REG_BASS = 0x02
var dword vs_bitrate
var byte _vs_volume_data_both[2] at _vs_volume_data
const byte VS_REG_AIADDR = 0x0A
var bit vs_pin_gpio5_direction_data at vs_port_gpio_direction_data : 5
var bit vs_pin_gpio7_data at vs_port_gpio_data : 7
const byte VS_REG_HDAT1 = 0x09
const byte VS_REG_STATUS = 0x01
const byte VS_REG_VOL = 0x0B
const byte VS_REG_AICTRL2 = 0x0E
var bit vs_pin_gpio6_direction_data at vs_port_gpio_direction_data : 6
const byte VS_REG_AICTRL1 = 0x0D
const byte _vs_table_layer2_id[15] = {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}
const byte VS_REG_WRAM = 0x06
var bit vs_pin_gpio1_direction_data at vs_port_gpio_direction_data : 1
var byte _vs_left_data at _vs_volume_data_both[0]
const byte VS_REG_HDAT0 = 0x08
var bit vs_pin_gpio0_data at vs_port_gpio_data : 0
const byte _vs_table_layer1_id3[15] = {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448}
const byte VS_REG_AICTRL0 = 0x0C
var bit vs_init_ok = FALSE
var byte*2 _vs_volume_data= 0
var sbyte _vs_current_volume_right = 0
var sbyte vs_current_treble = 0
var word vs_samplerate
var sbyte _vs_current_volume_left = 0
var bit vs_pin_gpio6_data at vs_port_gpio_data : 6
const word _vs_samplerate_id1[3] = {8000,12000,11025}
const byte VS_REG_MODE = 0x00
const byte VS_REG_AUDATA = 0x05
var byte vs_port_gpio_data = 0
var byte vs_current_bass = 0
const word _vs_samplerate_id3[3] = {32000,48000,44100}
const byte VS_REG_WRAMADDR = 0x07
const byte _vs_table_layer1_id[15] = {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256}
const byte _vs_table_layer3_id[15] = {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}
const word _vs_samplerate_id2[3] = {16000,24000,22050}
var bit vs_pin_gpio3_direction_data at vs_port_gpio_direction_data : 3
const byte VS_REG_AICTRL3 = 0x0F
var bit _vs_mute_data = FALSE
var bit vs_pin_gpio2_direction_data at vs_port_gpio_direction_data : 2
var bit vs_pin_gpio2_data at vs_port_gpio_data : 2
const byte _vs_table_layer3_id3[15] = {0,32,40,48,56,64,80,96,112,128,160,192,224,256,320}
var bit vs_pin_gpio5_data at vs_port_gpio_data : 5
var dword vs_average_bitrate
var bit vs_pin_gpio0_direction_data at vs_port_gpio_direction_data : 0
var byte vs_port_gpio_direction_data = 0
const byte VS_REG_CLOCKF = 0x03
var byte _vs_right_data at _vs_volume_data_both[1]
var byte _vs_current_volume = 0
var bit vs_pin_gpio1_data at vs_port_gpio_data : 1
var bit vs_pin_gpio4_data at vs_port_gpio_data : 4
vs_soft_reset()
vs_patch_vs1053b()
vs_volume_left'put(sbyte in data)
vs_pin_gpio7'put(bit in data)
vs_pin_gpio4'put(bit in data)
vs_play_mode()
vs_stop()
vs_register_read(byte in address,word out data)
vs_pin_gpio4_direction'put(bit in data)
vs_line_in_mode()
vs_pin_gpio5'put(bit in data)
vs_bass'put(byte in data)
vs_pin_gpio3_direction'put(bit in data)
vs_volume_right'put(sbyte in data)
vs_reg_read_to_serial(byte in register)
vs_pin_gpio6'put(bit in data)
vs_pin_gpio7_direction'put(bit in data)
vs_pin_gpio0'put(bit in data)
vs_pin_gpio6_direction'put(bit in data)
vs_file_info()
vs_pin_gpio2_direction'put(bit in data)
vs_register_write(byte in address, word in data)
vs_microphone_mode()
vs_pin_gpio3'put(bit in data)
vs_volume'put(byte in data)
vs_play()
vs_port_gpio_direction'put(byte in data)
vs_read_ram(word in address)
vs_mute'put(bit in data)
vs_init()
vs_pin_gpio1_direction'put(bit in data)
vs_play_speed'put(byte in data)
vs_pin_gpio1'put(bit in data)
vs_treble'put(sbyte in data)
vs_port_gpio'put(byte in data)
vs_pin_gpio0_direction'put(bit in data)
vs_pin_gpio5_direction'put(bit in data)
vs_pin_gpio2'put(bit in data)
vs_pin_gpio4'get() return bit
vs_pin_gpio1'get() return bit
vs_pin_gpio2'get() return bit
vs_pin_gpio3_direction'get() return bit
vs_pin_gpio3'get() return bit
vs_pin_gpio5_direction'get() return bit
vs_bass'get() return byte
vs_pin_gpio6_direction'get() return bit
vs_port_gpio_direction'get() return byte
vs_volume_left'get() return sbyte
vs_treble'get() return sbyte
vs_pin_gpio0_direction'get() return bit
vs_pin_gpio0'get() return bit
vs_pin_gpio2_direction'get() return bit
vs_pin_gpio7_direction'get() return bit
vs_pin_gpio1_direction'get() return bit
vs_volume_right'get() return sbyte
vs_port_gpio'get() return byte
vs_pin_gpio7'get() return bit
vs_pin_gpio4_direction'get() return bit
vs_volume'get() return byte
vs_pin_gpio5'get() return bit
vs_play_speed'get() return byte
vs_pin_gpio6'get() return bit
vs_mute'get() return bit
var bit vs_pin_gpio3_data at vs_port_gpio_data : 3
No documentation found
var byte vs_current_file_type[4]
holds current file type after vs_file_info()
var byte _vs_play_speed_data = 1
data variables for internal use only
const byte VS_REG_DECODE_TIME = 0x04
No documentation found
const byte _vs_table_layer2_id3[15] = {0,32,48,56,64,80,96,112,128,160,192,224,256,320,384}
No documentation found
var bit vs_pin_gpio7_direction_data at vs_port_gpio_direction_data : 7
No documentation found
var bit vs_pin_gpio4_direction_data at vs_port_gpio_direction_data : 4
No documentation found
const byte VS_REG_BASS = 0x02
No documentation found
var dword vs_bitrate
you can read these variables after calling vs_file_info()
var byte _vs_volume_data_both[2] at _vs_volume_data
No documentation found
const byte VS_REG_AIADDR = 0x0A
No documentation found
var bit vs_pin_gpio5_direction_data at vs_port_gpio_direction_data : 5
No documentation found
var bit vs_pin_gpio7_data at vs_port_gpio_data : 7
No documentation found
const byte VS_REG_HDAT1 = 0x09
No documentation found
const byte VS_REG_STATUS = 0x01
No documentation found
const byte VS_REG_VOL = 0x0B
No documentation found
const byte VS_REG_AICTRL2 = 0x0E
No documentation found
var bit vs_pin_gpio6_direction_data at vs_port_gpio_direction_data : 6
No documentation found
const byte VS_REG_AICTRL1 = 0x0D
No documentation found
const byte _vs_table_layer2_id[15] = {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}
No documentation found
const byte VS_REG_WRAM = 0x06
No documentation found
var bit vs_pin_gpio1_direction_data at vs_port_gpio_direction_data : 1
No documentation found
var byte _vs_left_data at _vs_volume_data_both[0]
No documentation found
const byte VS_REG_HDAT0 = 0x08
No documentation found
var bit vs_pin_gpio0_data at vs_port_gpio_data : 0
No documentation found
const byte _vs_table_layer1_id3[15] = {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448}
bitrate table for .mp3 at 8.7.9 in vs1053b datasheet
const byte VS_REG_AICTRL0 = 0x0C
No documentation found
var bit vs_init_ok = FALSE
if initialization was ok, this will change to TRUE
var byte*2 _vs_volume_data= 0
No documentation found
var sbyte _vs_current_volume_right = 0
No documentation found
var sbyte vs_current_treble = 0
No documentation found
var word vs_samplerate
sample rate (for .mp3 only)
var sbyte _vs_current_volume_left = 0
No documentation found
var bit vs_pin_gpio6_data at vs_port_gpio_data : 6
No documentation found
const word _vs_samplerate_id1[3] = {8000,12000,11025}
No documentation found
const byte VS_REG_MODE = 0x00
vs1053b registers for use with vs_register_read / vs_register_write procedures
const byte VS_REG_AUDATA = 0x05
No documentation found
var byte vs_port_gpio_data = 0
No documentation found
var byte vs_current_bass = 0
No documentation found
const word _vs_samplerate_id3[3] = {32000,48000,44100}
sample rate table for .mp3 at 8.7.9 in vs1053b datasheet
const byte VS_REG_WRAMADDR = 0x07
No documentation found
const byte _vs_table_layer1_id[15] = {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256}
No documentation found
const byte _vs_table_layer3_id[15] = {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}
No documentation found
const word _vs_samplerate_id2[3] = {16000,24000,22050}
No documentation found
var bit vs_pin_gpio3_direction_data at vs_port_gpio_direction_data : 3
No documentation found
const byte VS_REG_AICTRL3 = 0x0F
No documentation found
var bit _vs_mute_data = FALSE
No documentation found
var bit vs_pin_gpio2_direction_data at vs_port_gpio_direction_data : 2
No documentation found
var bit vs_pin_gpio2_data at vs_port_gpio_data : 2
No documentation found
const byte _vs_table_layer3_id3[15] = {0,32,40,48,56,64,80,96,112,128,160,192,224,256,320}
No documentation found
var bit vs_pin_gpio5_data at vs_port_gpio_data : 5
No documentation found
var dword vs_average_bitrate
actual average speed of incomming data
var bit vs_pin_gpio0_direction_data at vs_port_gpio_direction_data : 0
No documentation found
var byte vs_port_gpio_direction_data = 0
No documentation found
const byte VS_REG_CLOCKF = 0x03
No documentation found
var byte _vs_right_data at _vs_volume_data_both[1]
No documentation found
var byte _vs_current_volume = 0
No documentation found
var bit vs_pin_gpio1_data at vs_port_gpio_data : 1
No documentation found
var bit vs_pin_gpio4_data at vs_port_gpio_data : 4
No documentation found
vs_soft_reset()
No documentation found
vs_patch_vs1053b()
No documentation found
vs_volume_left'put(sbyte in data)
No documentation found
vs_pin_gpio7'put(bit in data)
pin vs_pin_gpio7
vs_pin_gpio4'put(bit in data)
pin vs_pin_gpio4
vs_play_mode()
No documentation found
vs_stop()
No documentation found
vs_register_read(byte in address,word out data)
No documentation found
vs_pin_gpio4_direction'put(bit in data)
No documentation found
vs_line_in_mode()
No documentation found
vs_pin_gpio5'put(bit in data)
pin vs_pin_gpio5
vs_bass'put(byte in data)
No documentation found
vs_pin_gpio3_direction'put(bit in data)
No documentation found
vs_volume_right'put(sbyte in data)
No documentation found
vs_reg_read_to_serial(byte in register)
No documentation found
vs_pin_gpio6'put(bit in data)
pin vs_pin_gpio6
vs_pin_gpio7_direction'put(bit in data)
No documentation found
vs_pin_gpio0'put(bit in data)
pin vs_pin_gpio0
vs_pin_gpio6_direction'put(bit in data)
No documentation found
vs_file_info()
No documentation found
vs_pin_gpio2_direction'put(bit in data)
No documentation found
vs_register_write(byte in address, word in data)
No documentation found
vs_microphone_mode()
No documentation found
vs_pin_gpio3'put(bit in data)
pin vs_pin_gpio3
vs_volume'put(byte in data)
No documentation found
vs_play()
No documentation found
vs_port_gpio_direction'put(byte in data)
No documentation found
vs_read_ram(word in address)
No documentation found
vs_mute'put(bit in data)
No documentation found
vs_init()
No documentation found
vs_pin_gpio1_direction'put(bit in data)
No documentation found
vs_play_speed'put(byte in data)
No documentation found
vs_pin_gpio1'put(bit in data)
pin vs_pin_gpio1
vs_treble'put(sbyte in data)
No documentation found
vs_port_gpio'put(byte in data)
port vs_port_gpio
vs_pin_gpio0_direction'put(bit in data)
No documentation found
vs_pin_gpio5_direction'put(bit in data)
No documentation found
vs_pin_gpio2'put(bit in data)
pin vs_pin_gpio2
_vs_send_mp3(byte in data)
No documentation found
_vs_set_bass_treble_set()
No documentation found
_vs_volume_set()
No documentation found
vs_pin_gpio4'get() return bit
No documentation found
vs_pin_gpio1'get() return bit
No documentation found
vs_pin_gpio2'get() return bit
No documentation found
vs_pin_gpio3_direction'get() return bit
No documentation found
vs_pin_gpio3'get() return bit
No documentation found
vs_pin_gpio5_direction'get() return bit
No documentation found
vs_bass'get() return byte
No documentation found
vs_pin_gpio6_direction'get() return bit
No documentation found
vs_port_gpio_direction'get() return byte
No documentation found
vs_volume_left'get() return sbyte
No documentation found
vs_treble'get() return sbyte
No documentation found
vs_pin_gpio0_direction'get() return bit
No documentation found
vs_pin_gpio0'get() return bit
No documentation found
vs_pin_gpio2_direction'get() return bit
No documentation found
vs_pin_gpio7_direction'get() return bit
No documentation found
vs_pin_gpio1_direction'get() return bit
No documentation found
vs_volume_right'get() return sbyte
No documentation found
vs_port_gpio'get() return byte
No documentation found
vs_pin_gpio7'get() return bit
No documentation found
vs_pin_gpio4_direction'get() return bit
No documentation found
vs_volume'get() return byte
No documentation found
vs_pin_gpio5'get() return bit
No documentation found
vs_play_speed'get() return byte
No documentation found
vs_pin_gpio6'get() return bit
No documentation found
vs_mute'get() return bit
No documentation found
Author | Vasile Surducan, Copyright (c) 2009..2010, all rights reserved. |
Adapted-by | Jean Marchaudon, Joep Suijs |
Compiler | >=2.4m |
Library to interface with Dallas / Maxim one-wire-bus devices Pin used for the 1-wire bus must be define these in your program before including the library. E.g.: alias d1w_bus is pin_c1 alias d1w_bus_out is pin_c1_direction
No dependency found
d1w_reset()
No documentation found
d1w_write_byte( byte in e )
No documentation found
d1w_read_byte( byte out c )
No documentation found
d1w_init()
No documentation found
_d1w_write_bit( bit in x )
No documentation found
_d1w_read_bit( bit out x )
No documentation found
d1w_present() return bit
No documentation found
16f648a | 16f648a_ds18b20_single.jal |
16f877 | 16f877_ds18b20_single.jal |
16f877a | 16f877a_ds18b20_single.jal |
16f88 | 16f88_ds18b20_single.jal |
18f2450 | 18f2450_ds18b20_single.jal |
18f4550 | 18f4550_ds18b20_single.jal |
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4k |
this library provides functions for pata/ide hard disk drives.
"connecting ide drives by tilmann reh" - http://www.gaby.de/gide/IDE-TCJ.txt IDE hardware reference & information document by alex t. ivopol ATA Attachement with Packet Interface 6 - d1410r3-ATA-ATAPI-6.pdf
- If you are not using Alternate Status, Digital Output or Drive Address registers pins cs1 & cs0 can be saved by connecting these ide pins to cs0-high, cs1-low at ide connector. normal operation does not require these pins. Set "CONST BYTE PATA_HD_USE_CS0_CS1_PINS = TRUE" if you will be using these registers - You MUST write full sectors of 512 bytes. - this lib does not do error checking
No dependency found
var byte pata_hd_sector_buffer_low[256]
const SD_CARD = 1
const PATA_HD_SPIN_UP = 0xE1
const PATA_HARD_DISK = 0
const PATA_HD_CYL_LOW_REG = 12
var byte pata_hd_sector_count2 = 0
const PATA_HD_SEC_NUM_REG = 11
const PATA_HD_DATA_REG = 8
var dword pata_hd_prev_address = 0
var dword pata_hd_last_sector
var bit pata_hd_last_operation
const PATA_HD_IDENTIFY_DRIVE = 0xEC
const PATA_HD_STATUS_REG = 15
const PATA_HD_CYL_HIGH_REG = 13
const PATA_HD_READ_SECTORS = 0x20
const PATA_HD_COMMAND_REG = 15
var bit pata_hd_byte_location = 0
const DATA_MEDIA = PATA_HARD_DISK
const bit PATA_HD_READ = 0
var byte pata_hd_sector_buffer_high[256]
const PATA_HD_SDH_REG = 14
const bit PATA_HD_WAIT_READ = 0
const bit PATA_HD_WAIT_WRITE = 1
const PATA_HD_DODC_REG = 16
const PATA_HD_SEC_COUNT_REG = 10
const PATA_HD_PRECOMP_REG = 9
const PATA_HD_ALT_STATUS_REG = 16
const PATA_HD_ADDRESS_REG = 17
const PATA_HD_SPIN_DOWN = 0xE0
const PATA_HD_WRITE_SECTORS = 0x30
const bit PATA_HD_WRITE = 1
const PATA_HD_RECALIBRATE = 0x10
var byte pata_hd_high_byte
var byte pata_hd_word_count = 0
var dword pata_hd_sector_select = 0
var byte pata_hd_sector_count = 0
const PATA_HD_ERROR_REG = 9
var byte pata_hd_high_byte2
var dword pata_hd_current_address = 0xFF_FF_FF_FF
pata_hd_write_pulse( byte in z )
pata_hd_read_data(byte out low_byte, byte out high_byte)
pata_hd_read_pulse(dword in amount)
pata_hd_register_read(byte in register, byte out low_byte)
pata_hd_register_write(byte in register, byte in low_byte)
pata_hd_set_address(byte in pata_hd_head_addr, byte in cyl_high_addr, byte in cyl_low_addr, byte in sec_num_addr, byte in sec_count)
pata_hd_write_data(byte in low_byte, byte in high_byte)
pata_hd_write_sector_address(dword in address)
pata_hd_read_sector_address(dword in address)
pata_hd_print_sector(volatile byte out device, dword in address)
pata_hd_read_sector()
pata_hd_write_to_sector_end(byte in input_byte)
pata_hd_data_byte'put(byte in data_byte)
pata_hd_busy()
pata_hd_init()
pata_hd_data_request(bit in read_write)
pata_hd_stop_write()
pata_hd_select_register(byte in register)
pata_hd_delay_100ns()
pata_hd_write_sector()
pata_hd_read_pulse_byte(dword in z)
pata_hd_start_read(dword in address)
pata_hd_set_idle()
pata_hd_go_to_sector(dword in sector, byte in sec_count)
pata_hd_drive_ready()
pata_hd_print_sector_hex(volatile byte out device,word in bytes_per_line,dword in address)
pata_hd_sector_buffer'put(word in address, byte in data)
pata_hd_write_pulse_byte(dword in z)
pata_hd_stop_read()
var byte pata_hd_sector_buffer_low[256]
256 low bytes
const SD_CARD = 1
No documentation found
const PATA_HD_SPIN_UP = 0xE1
turn on the drive's motor
const PATA_HARD_DISK = 0
data media constants for fat32 lib
const PATA_HD_CYL_LOW_REG = 12
cylinder low
var byte pata_hd_sector_count2 = 0
No documentation found
const PATA_HD_SEC_NUM_REG = 11
sector number
const PATA_HD_DATA_REG = 8
readable/writeable registers
var dword pata_hd_prev_address = 0
No documentation found
var dword pata_hd_last_sector
No documentation found
var bit pata_hd_last_operation
No documentation found
const PATA_HD_IDENTIFY_DRIVE = 0xEC
read drive info such as make/modem/sn/drive size
const PATA_HD_STATUS_REG = 15
status register (creates interupt)
const PATA_HD_CYL_HIGH_REG = 13
cylinder high
const PATA_HD_READ_SECTORS = 0x20
reads data from sector(s)
const PATA_HD_COMMAND_REG = 15
command register
var bit pata_hd_byte_location = 0
No documentation found
const DATA_MEDIA = PATA_HARD_DISK
No documentation found
const bit PATA_HD_READ = 0
wait for sector buffer to fill it's contents with data from disk platters
var byte pata_hd_sector_buffer_high[256]
256 high bytes
const PATA_HD_SDH_REG = 14
sector/drive/head register
const bit PATA_HD_WAIT_READ = 0
other constants used for pata_hd_data_request()
const bit PATA_HD_WAIT_WRITE = 1
wait for sector buffer to empty it's contents to disk platters
const PATA_HD_DODC_REG = 16
digital output / device control
const PATA_HD_SEC_COUNT_REG = 10
sector count
const PATA_HD_PRECOMP_REG = 9
writeable registers
const PATA_HD_ALT_STATUS_REG = 16
alternate status (no interupt)
const PATA_HD_ADDRESS_REG = 17
drive address
const PATA_HD_SPIN_DOWN = 0xE0
turn off the drive's motor
const PATA_HD_WRITE_SECTORS = 0x30
write data to sector(s)
const bit PATA_HD_WRITE = 1
wait for sector buffer to empty it's contents to disk platters
const PATA_HD_RECALIBRATE = 0x10
common commands for command register:
var byte pata_hd_high_byte
Write one byte to disk pseudo var
var byte pata_hd_word_count = 0
other vars
var dword pata_hd_sector_select = 0
No documentation found
var byte pata_hd_sector_count = 0
counds sectors read, must be a byte.
const PATA_HD_ERROR_REG = 9
readable registers
var byte pata_hd_high_byte2
Read one byte (pseudo var)
var dword pata_hd_current_address = 0xFF_FF_FF_FF
No documentation found
pata_hd_write_pulse( byte in z )
Send a number of write pulses to data register sending 0's as data. Used to get to the end of a sector or to get to a certain location in a sector. Increment pata_hd_word_count
pata_hd_read_data(byte out low_byte, byte out high_byte)
Read two bytes from disk.
pata_hd_read_pulse(dword in amount)
Send a number of read pulses to data register without getting any data. Goes forward 2 bytes per amount Used to get to the end of a sector or to get to a certain location in a sector. Increment pata_hd_word_count
pata_hd_register_read(byte in register, byte out low_byte)
Select a register and get data from it.
pata_hd_register_write(byte in register, byte in low_byte)
Select a register and give it a command or data.
pata_hd_set_address(byte in pata_hd_head_addr, byte in cyl_high_addr, byte in cyl_low_addr, byte in sec_num_addr, byte in sec_count)
Go to a specific sector, select lba/chs mode and master/slave drive Max sector number is 0x0F_FF_FF_FF or the number of sectors the drive has. Max drive size is 0x0F_FF_FF_FF * 512 = 137.439 GB Sector count selects number of sectors that will be read Sector count value of 0 means 256 sectors will be read
pata_hd_write_data(byte in low_byte, byte in high_byte)
Write two bytes to disk Data will not be written unless 256 writes are sent.
pata_hd_write_sector_address(dword in address)
No documentation found
pata_hd_read_sector_address(dword in address)
No documentation found
pata_hd_print_sector(volatile byte out device, dword in address)
print a sector to an output device
pata_hd_read_sector()
No documentation found
pata_hd_write_to_sector_end(byte in input_byte)
Finnish writing the current sector with input byte.
pata_hd_data_byte'put(byte in data_byte)
No documentation found
pata_hd_busy()
Registers may not be accessed unless bsy bit is low due to internal operations.
pata_hd_init()
initialize startup settings
pata_hd_data_request(bit in read_write)
Wait for drive to be ready for a data transfer. Sets data pins as inputs or outputs for next read or write.
pata_hd_stop_write()
Tell drive you are done writing
pata_hd_select_register(byte in register)
Set register select pins to selected register, for internal use only.
pata_hd_delay_100ns()
100ns delay procedure
pata_hd_write_sector()
Write one sector to the disk, requires start write/stop write.
pata_hd_read_pulse_byte(dword in z)
goes to next byte instead of word like pata_hd_read_pulse
pata_hd_start_read(dword in address)
Get drive ready for reading at specified address
pata_hd_set_idle()
Set hard disk to idle state
pata_hd_go_to_sector(dword in sector, byte in sec_count)
Go to a specific sector number (lba mode only) Max sector number is 268435455 or the number of sectors the drive has. Max drive size is 268435455 * 512 = 137.439 GB Sector count selects number of sectors that will be read Sector count value of 0 means 256 sectors will be read
pata_hd_drive_ready()
Wait for drive to be up to speed and ready for a command.
pata_hd_print_sector_hex(volatile byte out device,word in bytes_per_line,dword in address)
print a sector to an output device in ascii hex
pata_hd_sector_buffer'put(word in address, byte in data)
No documentation found
pata_hd_write_pulse_byte(dword in z)
goes to next byte instead of word like pata_hd_write_pulse
pata_hd_stop_read()
Tell drive you are done reading
_pata_read_512()
No documentation found
pata_hd_data_byte'get() return byte
No documentation found
pata_hd_sector_buffer'get(word in address) return byte
No documentation found
Author | Eur van Andel, eur@fiwihex.nl (c) 2009 |
Adapted-by | |
Compiler | >=2.4g |
AC induction motors are low-priced, very reliable and widely available. This library provides a way to control the speed of these motors, if they have reasonably angular momentum. Explanation: this is *NOT* phase control: http://en.wikipedia.org/wiki/Phase_control Phase control makes a lot of noise, both audible and electrical. This is deliberate skipping of half-waves. There are only 100 half-waves per second @ 50 Hz and bit-fine control of motor speed would result in long duty cycles (2.55s) with varying motor speeds and audible pitch change. So we keep the period cycle at 32 half waves, with 8 duty cycles that only differ one half-wave to minimise audible noise. Electrical noise is minimized by zero-voltage switching.
Fairchild Application Note AN-3004, http://www.fairchildsemi.com/an/AN/AN-3004.pdf http://www.sullivan-county.com/ele/triacs2.htm for schematics and examples how to generate a zero-crossing signal.
No dependency found
var byte div8, mod8
var byte ps_on_1, ps_on_2, ps_on_3, ps_on_4, ps_on_5, ps_on_6, ps_on_7, ps_on_8
var byte ps_counter
var byte ps_on_period = 0
var byte ps_total_duty_cycle
var byte div8, mod8
No documentation found
var byte ps_on_1, ps_on_2, ps_on_3, ps_on_4, ps_on_5, ps_on_6, ps_on_7, ps_on_8
No documentation found
var byte ps_counter
1..32 ISR period counter
var byte ps_on_period = 0
No documentation found
var byte ps_total_duty_cycle
position in total duty cycle
RTC()
No documentation found
ps_check_period()
should be called every 320 ms @ 50 Hz!
ps_adjust_period()
No documentation found
16f877 | 16f877_period_skip.jal |
Author | Stef Mientki, Copyright (c) 2002..2006, all rights reserved. |
Adapted-by | Sebastien Lelong, Rob Hamerling, Joep Suijs (on behalf of Tijs van Roon). |
Compiler | >=2.4i |
Read from or write to EEPROM/data a byte, word or double word. Available procedures: * data_eeprom_read(, ) * data_eeprom_write( , ) * data_eeprom_read_word( , ) * data_eeprom_write_word( , ) * data_eeprom_read_dword( , ) * data_eeprom_write_dword( , ) Available functions: * = data_eeprom( ) * = data_eeprom_word( ) * = data_eeprom_dword( ) In all cases is a position relative to the beginning of EEPROM/data memory, thus starts at 0. Examples of use: * Read a byte of EEPROM at offset 7 into x: var byte x data_eeprom_read(7, x) * Read a word from EEPROM at offset 4 into y: var word y y = data_eeprom_word(4) * Write a byte to EEPROM at offset 18: data_eeprom_write(18, 0b1111_0000)
- Write-protect bits in configuration memory may prohibit writing. - Writing to locations outside the available memory range may have unexpected effects! - Summary of changes + Changed byte-offset to word-offset for larger EEPROMs with 18Fs + Offset and flags settings for read and write in separate procedure. + Moved check for write completed ahead of read and write, for performance (ahead of read needed for read back of same offset). + added 'pragma inline' to several procedures + some other code optimizations + added support for PICs with deviating register names, like 'EEDAT' or EEDATL in stead of 'EEDATA' and EEADRL in stead of EEADR.
No dependency found
data_eeprom_read_word(word in offset, word out data)
data_eeprom_read_dword(word in offset, dword out data)
data_eeprom_write_word(word in offset, word in data)
data_eeprom_write_dword(word in offset, dword in data)
data_eeprom_write(word in offset, byte in data)
data_eeprom_read(word in offset, byte out data)
data_eeprom(word in offset) return byte
data_eeprom_dword(word in offset) return dword
data_eeprom_word(word in offset) return word
data_eeprom_read_word(word in offset, word out data)
Read word from data eeprom at given offset Result is stored in the passed in-argument
data_eeprom_read_dword(word in offset, dword out data)
Read a dword from data eeprom at given offset Result is stored in the passed in-argument
data_eeprom_write_word(word in offset, word in data)
Write word to data eeprom at given offset
data_eeprom_write_dword(word in offset, dword in data)
Write dword to data eeprom at given offset
data_eeprom_write(word in offset, byte in data)
Write byte to data EEPROM at given offset
data_eeprom_read(word in offset, byte out data)
Read byte from data EEPROM at given offset Result is stored in the passed in-argument
_prepare_eeprom_access(word in offset)
No documentation found
data_eeprom(word in offset) return byte
Read byte from data EEPROM at given offset and return result
data_eeprom_dword(word in offset) return dword
Read dword from data eeprom at given offset and return result
data_eeprom_word(word in offset) return word
Read word from data eeprom at given offset and return result
16f648a | 16f648a_data_eeprom.jal |
16f877a | 16f877a_data_eeprom.jal |
16f88 | 16f88_data_eeprom.jal |
16f88 | 16f88_remember_me.jal |
18f14k50 | 18f14k50_data_eeprom.jal |
18f242 | 18f242_data_eeprom.jal |
18f2620 | 18f2620_data_eeprom.jal |
18f4550 | 18f4550_data_eeprom.jal |
18f6722 | 18f6722_data_eeprom.jal |
Author | Sebastien Lelong, Copyright (C) 2009, all rights reserved. |
Adapted-by | |
Compiler | 2.4m |
This library provides a set of utility functions and procedures to help users manipulating pins. For instance, you can dynamically access pins using a specific mapping (RA0 is #0, RB1 is #2, etc...) and act on levels, mode, directions, etc... Using this library requires that array "pintools_map" is first defined. This array is composed by elements going by two: * the first element corresponds to the port letter ("A", "B", ...) * the second element corresponds to the pin number in this port (0, 1, 2, ...) Pins are then accessed according to the index in this array (starting with 0) Ex: const byte pintools_map [] = {"A","1", "B","1", "D","3} This 6 elements (2x3) array specifies that: * pin #0 corresponds to pin_A1 * pin #1 corresponds to pin_B1 * pin #2 corresponds to pin_D3
this library hasn't been fully tested, this is still BETA...
No dependency found
pintools_set_direction(byte in pinnum, bit in direction)
pintools_level'put(byte in pinnum, bit in level)
pintools_direction'put(byte in pinnum, bit in direction)
pintools_set_level(byte in pinnum, bit in level)
pintools_set_direction(byte in pinnum, bit in direction)
Access pin by number and set its direction (low/high)
pintools_level'put(byte in pinnum, bit in level)
No documentation found
pintools_direction'put(byte in pinnum, bit in direction)
No documentation found
pintools_set_level(byte in pinnum, bit in level)
No documentation found
pintools_direction'get(byte in pinnum) return bit
No documentation found
pintools_level'get(byte in pinnum) return bit
No documentation found
18f4550 | 18f4550_pintools.jal |
Author | Sebastien Lelong, Copyright (c) 2011, all rights reserved. |
Adapted-by | |
Compiler | >=2.4o |
This library provides several utility functions to deal with Peripheral Pin Select (PPS) module. PPS is a special feature implemented on recent PIC (currently 18FXXJ11, 18FXXJ13, 18FXXJ50, 18FXXJ53). PPS allows to dynamically assign function to pins known as "remappable pins". These pins are easily identified as they're name "RPn". . Assigning function to pins is done differently wheter function is an input or output. When function is an input (eg. serial RX), PPS is used by specifying, for this function, what is the RP pins to be used. On the other side, when function is an output (eg. serial TX), PPS is used by specifying, for this RP pin, what is the function it should carry. As a consequence, several RP pins can carry the same output function. . In order to configure RP pins, PPS module must be unlocked using pps_begin(), pins should be remapped calling corresponding procedure and setting appropriate function ID number, then locked again using pps_commit(). This is a security guard used to prevent any unintentional changes. When PPS uses 1-way locking (default behavior), pins can be remapped only once (when PPS is becoming locked again, any further changes are ignored). When PPS don't use 1-way locking, several unlock/lock sequences can occur at runtime. If this behavior is wanted, the following fuse setting should be used: pragma target IOL1WAY disabled . Please refer to datasheet in order to have a better overview of PPS.
No dependency found
const byte RP18 = 18
const byte RP15 = 15
const byte RP12 = 12
const byte RP19 = 19
const byte RP10 = 10
const byte RP6 = 6
const byte RP8 = 8
const byte RP2 = 2
const byte RP5 = 5
const byte RP24 = 24
const byte RP1 = 1
const byte RP20 = 20
const byte RP11 = 11
const byte RP22 = 22
const byte RP0 = 0
const byte RP21 = 21
const byte RP16 = 16
const byte RP14 = 14
const byte RP4 = 4
const byte RP7 = 7
const byte RP3 = 3
const byte RP23 = 23
const byte RP13 = 13
const byte RP9 = 9
var bit _pps_gie_state = INTCON_GIE
const byte RP17 = 17
const byte RP18 = 18
No documentation found
const byte RP15 = 15
No documentation found
const byte RP12 = 12
No documentation found
const byte RP19 = 19
No documentation found
const byte RP10 = 10
No documentation found
const byte RP6 = 6
No documentation found
const byte RP8 = 8
No documentation found
const byte RP2 = 2
No documentation found
const byte RP5 = 5
No documentation found
const byte RP24 = 24
No documentation found
const byte RP1 = 1
No documentation found
const byte RP20 = 20
No documentation found
const byte RP11 = 11
No documentation found
const byte RP22 = 22
No documentation found
const byte RP0 = 0
No documentation found
const byte RP21 = 21
No documentation found
const byte RP16 = 16
No documentation found
const byte RP14 = 14
No documentation found
const byte RP4 = 4
No documentation found
const byte RP7 = 7
No documentation found
const byte RP3 = 3
No documentation found
const byte RP23 = 23
No documentation found
const byte RP13 = 13
No documentation found
const byte RP9 = 9
No documentation found
var bit _pps_gie_state = INTCON_GIE
No documentation found
const byte RP17 = 17
No documentation found
pps_control_lock(bit in state)
Lock/unlock PPS module, allowing pins to be remapped. If 1-way locking is used this procedure must only be called once. Once remappable pins are configured PPS must be locked again to apply changes Note: interrupts are temporarily disabled. When pps_lock(true) is called interrupts are restored back to previous state
18f27j53 | 18f27j53_pps_rx2tx2.jal |
Author | Joep Suijs, Copyright (c) 2007..2008, all rights reserved. |
Adapted-by | Joep Suijs, Michael Watterson |
Compiler | >=2.2 |
Outputs variables to output device. formats: _decimal and _hex vars: bit, byte, sbyte, word, sword, dword, sdword Example: var sword bhl = -684 ; print the signed word to the LCD display print_sword_dec(lcd_char, bhl) ; and now print the same signed word to the serial port print_sword_dec(serial_hw_data, bhl) ; Specials: print_crlf(serial_hw_data) -- print cr + lf to device ; const byte str1[] = "JalLibWorld V1.0\n" print_string(serial_hw_data, str1) -- print string to device ; ; Note - the whole string - that is the length of the array - ; is printed. When you use a variable array to construct strings, ; you might want to terminate at a termination character, like 0. ; You can set this termination character with: ; const print_string_terminator = 255 ; (or use a var if you want to change it runtime.) ; include print
print_sword_fp_dec uses "fixed point" integer, -127.256 to +127.256 Imagine the decimal. Thus 0x110 = 1.5 as 128 = 0.5 and 256 = 1
var bit print_prefix = false
const byte nibble2hex[] = "0123456789ABCDEF"
const dword digit_divisor[] = { 1, 10, 100, 1_000, 10_000, 100_000, 1_000_000, 10_000_000, 100_000_000, 1_000_000_000 }
print_word_dec(volatile byte out device, word in data)
print_byte_binary(volatile byte out device, byte in data)
print_sbyte_dec(volatile byte out device, sbyte in data)
print_sword_fp_dec(volatile byte out device, sword in data)
print_sword_dec(volatile byte out device, sword in data)
print_string(volatile byte out device, byte in str[])
print_bit_highlow(volatile byte out device, bit in data)
print_word_hex(volatile byte out device, word in data)
print_byte_dec(volatile byte out device, byte in data)
print_byte_hex(volatile byte out device, byte in data)
print_bit_10(volatile byte out device, bit in data)
print_sdword_hex(volatile byte out device, sdword in data)
print_dword_binary(volatile byte out device, dword in data)
print_crlf(volatile byte out device)
print_sdword_dec(volatile byte out device, sdword in data)
print_sword_hex(volatile byte out device, sword in data)
print_nibble_binary(volatile byte out device, byte in data)
print_word_binary(volatile byte out device, word in data)
print_dword_hex(volatile byte out device, dword in data)
print_dword_dec(volatile byte out device, dword in data)
print_bit_truefalse(volatile byte out device, bit in data)
_print_universal_dec(volatile byte out device, dword in data, sbyte in divisor_index)
_print_suniversal_dec(volatile byte out device, sdword in data, sbyte in divisor_index)
var bit print_prefix = false
No documentation found
const byte nibble2hex[] = "0123456789ABCDEF"
conversion string
const dword digit_divisor[] = { 1, 10, 100, 1_000, 10_000, 100_000, 1_000_000, 10_000_000, 100_000_000, 1_000_000_000 }
No documentation found
print_word_dec(volatile byte out device, word in data)
No documentation found
print_byte_binary(volatile byte out device, byte in data)
No documentation found
print_sbyte_dec(volatile byte out device, sbyte in data)
No documentation found
print_sword_fp_dec(volatile byte out device, sword in data)
8 bit fixed point integer math
print_sword_dec(volatile byte out device, sword in data)
No documentation found
print_string(volatile byte out device, byte in str[])
No documentation found
print_bit_highlow(volatile byte out device, bit in data)
No documentation found
print_word_hex(volatile byte out device, word in data)
No documentation found
print_byte_dec(volatile byte out device, byte in data)
No documentation found
print_byte_hex(volatile byte out device, byte in data)
No documentation found
print_bit_10(volatile byte out device, bit in data)
No documentation found
print_sdword_hex(volatile byte out device, sdword in data)
No documentation found
print_dword_binary(volatile byte out device, dword in data)
No documentation found
print_crlf(volatile byte out device)
No documentation found
print_sdword_dec(volatile byte out device, sdword in data)
No documentation found
print_sword_hex(volatile byte out device, sword in data)
No documentation found
print_nibble_binary(volatile byte out device, byte in data)
No documentation found
print_word_binary(volatile byte out device, word in data)
No documentation found
print_dword_hex(volatile byte out device, dword in data)
No documentation found
print_dword_dec(volatile byte out device, dword in data)
No documentation found
print_bit_truefalse(volatile byte out device, bit in data)
No documentation found
_print_universal_dec(volatile byte out device, dword in data, sbyte in divisor_index)
No documentation found
_print_suniversal_dec(volatile byte out device, sdword in data, sbyte in divisor_index)
No documentation found
Author | Joep Suijs, Copyright (c) 2009..2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4g |
This library provides procedures to profile code parts. Intended for software development, uses timer1.
No dependency found
profiler_report(volatile byte out device)
profiler_start()
profiler_stop()
profiler_stop_and_report(volatile byte in out device)
profiler_setup(byte in resolution)
const byte m2[] = " us"
No documentation found
const byte m1[] = "Profiler "
No documentation found
profiler_report(volatile byte out device)
No documentation found
profiler_start()
No documentation found
profiler_stop()
No documentation found
profiler_stop_and_report(volatile byte in out device)
No documentation found
profiler_setup(byte in resolution)
No documentation found
16f648a | 16f648a_sqrt.jal |
16f723 | 16f723_sqrt.jal |
16f73 | 16f73_sqrt.jal |
16f877 | 16f877_sqrt.jal |
16f877a | 16f877a_sqrt.jal |
16f88 | 16f88_sqrt.jal |
18f14k50 | 18f14k50_sqrt.jal |
18f2450 | 18f2450_sqrt.jal |
18f4550 | 18f4550_sqrt.jal |
Author | Stef Mientki, Copyright (C) 2002-2006, all rights reserved. |
Adapted-by | Sebastien Lelong, Rob Hamerling. |
Compiler | 2.4l |
Performs PWM operations on the CCP1 module. This file is automatically included by pwm_hardware.jal when the target PIC has a CCP1 module.
1. This is a heavy refactoring of the original pwm_hardware.jal (Stef's lib) 2. Partly rewritten for JalV2 version 2.4l and Jallib revision 1171. Reduced memory occupation. Added procedure for lowres PWM.
No dependency found
var bit*4 _ccp1con_shadow_ccp1m at _ccp1con_shadow : 0
var byte _ccpr1l_shadow = 0
var bit*2 _ccp1con_shadow_dc1b at _ccp1con_shadow : 4
var byte _ccp1con_shadow = 0b0000_0000
pwm1_set_percent_dutycycle(byte in percent)
pwm1_on()
pwm1_off()
pwm1_set_dutycycle_lowres(byte in duty)
pwm1_set_dutycycle_highres(word in duty)
pwm1_set_dutycycle(byte in duty)
var bit*4 _ccp1con_shadow_ccp1m at _ccp1con_shadow : 0
mode pattern
var byte _ccpr1l_shadow = 0
8 MSbits of duty cycle
var bit*2 _ccp1con_shadow_dc1b at _ccp1con_shadow : 4
2 LSbits of duty cycle
var byte _ccp1con_shadow = 0b0000_0000
shadow
pwm1_set_percent_dutycycle(byte in percent)
Set a percentage duty cycle, allowing max 100 PWM steps. Allowed range: 0..100 The duty cycle will be set to the specified percentage of the maximum for the current PWM frequency. Note: The number of available PWM steps can be lower than 100 with (very) high PWM frequencies. Note: pin_CCP1_direction should be set to output!
pwm1_on()
PWM mode on Restore duty cycle from shadow registers Note: pin_CCP1_direction should be set to output!
pwm1_off()
PWM mode off retain duty cycle setting in shadow registers
pwm1_set_dutycycle_lowres(byte in duty)
Set dutycycle with 8-bits resolution allowing 255 PWM steps. The 'duty' argument is the 8-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<7:2> are the 6 MSbits Allowed range: 0..255 Beware that steps 256..1023 are not available. In other words the available PWM range is 25% of the highres procedure. This procedure is particularly suitable with higher frequencies whereby the PWM resolution is limited to 256 steps or less!
pwm1_set_dutycycle_highres(word in duty)
Set dutycycle with 10-bits resolution, allowing 1024 PWM steps. The 'duty' argument is a (max) 10-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<9:2> are the 8 MSbits Allowed range: 0..1023 Note: pin_CCP1_direction should be set to output!
pwm1_set_dutycycle(byte in duty)
Set dutycycle for 10-bits resolution but allowing only 255 PWM steps. This procedure is equivalent to pwm1_set_dutycycle_highres(), but the low order 2 bits of the 10-bits duty cycle are set to 0. This means that only every 4th of the available 1023 steps can be selected and consequently max 255 PWM steps are available. This procedure is for user convenience, allowing to specify an 8 bits value for the duty cycle is for many applications satisfactory. Calling this procedure will also activate PWM. Note: pin_CCP1_direction should be set to output!
Author | Stef Mientki, Copyright (C) 2002-2006, all rights reserved. |
Adapted-by | Sebastien Lelong, Rob Hamerling. |
Compiler | 2.4l |
Performs PWM operations on the CCP10 module. This file is automatically included by pwm_hardware.jal when the target PIC has a CCP10 module.
1. This is a heavy refactoring of the original pwm_hardware.jal (Stef's lib) 2. Partly rewritten for JalV2 version 2.4l and Jallib revision 1171. Reduced memory occupation. Added procedure for lowres PWM.
No dependency found
var bit*4 _ccp10con_shadow_ccp10m at _ccp10con_shadow : 0
var byte _ccpr10l_shadow = 0
var byte _ccp10con_shadow = 0b0000_0000
var bit*2 _ccp10con_shadow_dc10b at _ccp10con_shadow : 4
pwm10_on()
pwm10_set_dutycycle_lowres(byte in duty)
pwm10_set_dutycycle(byte in duty)
pwm10_set_dutycycle_highres(word in duty)
pwm10_set_percent_dutycycle(byte in percent)
pwm10_off()
var bit*4 _ccp10con_shadow_ccp10m at _ccp10con_shadow : 0
mode pattern
var byte _ccpr10l_shadow = 0
8 MSbits of duty cycle
var byte _ccp10con_shadow = 0b0000_0000
shadow
var bit*2 _ccp10con_shadow_dc10b at _ccp10con_shadow : 4
2 LSbits of duty cycle
pwm10_on()
PWM mode on Restore duty cycle from shadow registers Note: pin_CCP10_direction should be set to output!
pwm10_set_dutycycle_lowres(byte in duty)
Set dutycycle with 8-bits resolution allowing 255 PWM steps. The 'duty' argument is the 8-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<7:2> are the 6 MSbits Allowed range: 0..255 Beware that steps 256..1023 are not available. In other words the available PWM range is 25% of the highres procedure. This procedure is particularly suitable with higher frequencies whereby the PWM resolution is limited to 256 steps or less!
pwm10_set_dutycycle(byte in duty)
Set dutycycle for 10-bits resolution but allowing only 255 PWM steps. This procedure is equivalent to pwm10_set_dutycycle_highres(), but the low order 2 bits of the 10-bits duty cycle are set to 0. This means that only every 4th of the available 1023 steps can be selected and consequently max 255 PWM steps are available. This procedure is for user convenience, allowing to specify an 8 bits value for the duty cycle is for many applications satisfactory. Calling this procedure will also activate PWM. Note: pin_CCP10_direction should be set to output!
pwm10_set_dutycycle_highres(word in duty)
Set dutycycle with 10-bits resolution, allowing 1024 PWM steps. The 'duty' argument is a (max) 10-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<9:2> are the 8 MSbits Allowed range: 0..1023 Note: pin_CCP10_direction should be set to output!
pwm10_set_percent_dutycycle(byte in percent)
Set a percentage duty cycle, allowing max 100 PWM steps. Allowed range: 0..100 The duty cycle will be set to the specified percentage of the maximum for the current PWM frequency. Note: The number of available PWM steps can be lower than 100 with (very) high PWM frequencies. Note: pin_CCP10_direction should be set to output!
pwm10_off()
PWM mode off retain duty cycle setting in shadow registers
Author | Stef Mientki, Copyright (C) 2002-2006, all rights reserved. |
Adapted-by | Sebastien Lelong, Rob Hamerling. |
Compiler | 2.4l |
Performs PWM operations on the CCP2 module. This file is automatically included by pwm_hardware.jal when the target PIC has a CCP2 module.
1. This is a heavy refactoring of the original pwm_hardware.jal (Stef's lib) 2. Partly rewritten for JalV2 version 2.4l and Jallib revision 1171. Reduced memory occupation. Added procedure for lowres PWM.
No dependency found
var byte _ccp2con_shadow = 0b0000_0000
var byte _ccpr2l_shadow = 0
var bit*2 _ccp2con_shadow_dc2b at _ccp2con_shadow : 4
var bit*4 _ccp2con_shadow_ccp2m at _ccp2con_shadow : 0
pwm2_set_dutycycle(byte in duty)
pwm2_off()
pwm2_set_dutycycle_lowres(byte in duty)
pwm2_on()
pwm2_set_dutycycle_highres(word in duty)
pwm2_set_percent_dutycycle(byte in percent)
var byte _ccp2con_shadow = 0b0000_0000
shadow
var byte _ccpr2l_shadow = 0
8 MSbits of duty cycle
var bit*2 _ccp2con_shadow_dc2b at _ccp2con_shadow : 4
2 LSbits of duty cycle
var bit*4 _ccp2con_shadow_ccp2m at _ccp2con_shadow : 0
mode pattern
pwm2_set_dutycycle(byte in duty)
Set dutycycle for 10-bits resolution but allowing only 255 PWM steps. This procedure is equivalent to pwm2_set_dutycycle_highres(), but the low order 2 bits of the 10-bits duty cycle are set to 0. This means that only every 4th of the available 1023 steps can be selected and consequently max 255 PWM steps are available. This procedure is for user convenience, allowing to specify an 8 bits value for the duty cycle is for many applications satisfactory. Calling this procedure will also activate PWM. Note: pin_CCP2_direction should be set to output!
pwm2_off()
PWM mode off retain duty cycle setting in shadow registers
pwm2_set_dutycycle_lowres(byte in duty)
Set dutycycle with 8-bits resolution allowing 255 PWM steps. The 'duty' argument is the 8-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<7:2> are the 6 MSbits Allowed range: 0..255 Beware that steps 256..1023 are not available. In other words the available PWM range is 25% of the highres procedure. This procedure is particularly suitable with higher frequencies whereby the PWM resolution is limited to 256 steps or less!
pwm2_on()
PWM mode on Restore duty cycle from shadow registers Note: pin_CCP2_direction should be set to output!
pwm2_set_dutycycle_highres(word in duty)
Set dutycycle with 10-bits resolution, allowing 1024 PWM steps. The 'duty' argument is a (max) 10-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<9:2> are the 8 MSbits Allowed range: 0..1023 Note: pin_CCP2_direction should be set to output!
pwm2_set_percent_dutycycle(byte in percent)
Set a percentage duty cycle, allowing max 100 PWM steps. Allowed range: 0..100 The duty cycle will be set to the specified percentage of the maximum for the current PWM frequency. Note: The number of available PWM steps can be lower than 100 with (very) high PWM frequencies. Note: pin_CCP2_direction should be set to output!
Author | Stef Mientki, Copyright (C) 2002-2006, all rights reserved. |
Adapted-by | Sebastien Lelong, Rob Hamerling. |
Compiler | 2.4l |
Performs PWM operations on the CCP3 module. This file is automatically included by pwm_hardware.jal when the target PIC has a CCP3 module.
1. This is a heavy refactoring of the original pwm_hardware.jal (Stef's lib) 2. Partly rewritten for JalV2 version 2.4l and Jallib revision 1171. Reduced memory occupation. Added procedure for lowres PWM.
No dependency found
var bit*2 _ccp3con_shadow_dc3b at _ccp3con_shadow : 4
var bit*4 _ccp3con_shadow_ccp3m at _ccp3con_shadow : 0
var byte _ccp3con_shadow = 0b0000_0000
var byte _ccpr3l_shadow = 0
pwm3_on()
pwm3_set_dutycycle(byte in duty)
pwm3_set_dutycycle_lowres(byte in duty)
pwm3_set_dutycycle_highres(word in duty)
pwm3_set_percent_dutycycle(byte in percent)
pwm3_off()
var bit*2 _ccp3con_shadow_dc3b at _ccp3con_shadow : 4
2 LSbits of duty cycle
var bit*4 _ccp3con_shadow_ccp3m at _ccp3con_shadow : 0
mode pattern
var byte _ccp3con_shadow = 0b0000_0000
shadow
var byte _ccpr3l_shadow = 0
8 MSbits of duty cycle
pwm3_on()
PWM mode on Restore duty cycle from shadow registers Note: pin_CCP3_direction should be set to output!
pwm3_set_dutycycle(byte in duty)
Set dutycycle for 10-bits resolution but allowing only 255 PWM steps. This procedure is equivalent to pwm3_set_dutycycle_highres(), but the low order 2 bits of the 10-bits duty cycle are set to 0. This means that only every 4th of the available 1023 steps can be selected and consequently max 255 PWM steps are available. This procedure is for user convenience, allowing to specify an 8 bits value for the duty cycle is for many applications satisfactory. Calling this procedure will also activate PWM. Note: pin_CCP3_direction should be set to output!
pwm3_set_dutycycle_lowres(byte in duty)
Set dutycycle with 8-bits resolution allowing 255 PWM steps. The 'duty' argument is the 8-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<7:2> are the 6 MSbits Allowed range: 0..255 Beware that steps 256..1023 are not available. In other words the available PWM range is 25% of the highres procedure. This procedure is particularly suitable with higher frequencies whereby the PWM resolution is limited to 256 steps or less!
pwm3_set_dutycycle_highres(word in duty)
Set dutycycle with 10-bits resolution, allowing 1024 PWM steps. The 'duty' argument is a (max) 10-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<9:2> are the 8 MSbits Allowed range: 0..1023 Note: pin_CCP3_direction should be set to output!
pwm3_set_percent_dutycycle(byte in percent)
Set a percentage duty cycle, allowing max 100 PWM steps. Allowed range: 0..100 The duty cycle will be set to the specified percentage of the maximum for the current PWM frequency. Note: The number of available PWM steps can be lower than 100 with (very) high PWM frequencies. Note: pin_CCP3_direction should be set to output!
pwm3_off()
PWM mode off retain duty cycle setting in shadow registers
Author | Stef Mientki, Copyright (C) 2002-2006, all rights reserved. |
Adapted-by | Sebastien Lelong, Rob Hamerling. |
Compiler | 2.4l |
Performs PWM operations on the CCP4 module. This file is automatically included by pwm_hardware.jal when the target PIC has a CCP4 module.
1. This is a heavy refactoring of the original pwm_hardware.jal (Stef's lib) 2. Partly rewritten for JalV2 version 2.4l and Jallib revision 1171. Reduced memory occupation. Added procedure for lowres PWM.
No dependency found
var bit*4 _ccp4con_shadow_ccp4m at _ccp4con_shadow : 0
var bit*2 _ccp4con_shadow_dc4b at _ccp4con_shadow : 4
var byte _ccp4con_shadow = 0b0000_0000
var byte _ccpr4l_shadow = 0
pwm4_set_dutycycle_lowres(byte in duty)
pwm4_off()
pwm4_on()
pwm4_set_percent_dutycycle(byte in percent)
pwm4_set_dutycycle(byte in duty)
pwm4_set_dutycycle_highres(word in duty)
var bit*4 _ccp4con_shadow_ccp4m at _ccp4con_shadow : 0
mode pattern
var bit*2 _ccp4con_shadow_dc4b at _ccp4con_shadow : 4
2 LSbits of duty cycle
var byte _ccp4con_shadow = 0b0000_0000
shadow
var byte _ccpr4l_shadow = 0
8 MSbits of duty cycle
pwm4_set_dutycycle_lowres(byte in duty)
Set dutycycle with 8-bits resolution allowing 255 PWM steps. The 'duty' argument is the 8-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<7:2> are the 6 MSbits Allowed range: 0..255 Beware that steps 256..1023 are not available. In other words the available PWM range is 25% of the highres procedure. This procedure is particularly suitable with higher frequencies whereby the PWM resolution is limited to 256 steps or less!
pwm4_off()
PWM mode off retain duty cycle setting in shadow registers
pwm4_on()
PWM mode on Restore duty cycle from shadow registers Note: pin_CCP4_direction should be set to output!
pwm4_set_percent_dutycycle(byte in percent)
Set a percentage duty cycle, allowing max 100 PWM steps. Allowed range: 0..100 The duty cycle will be set to the specified percentage of the maximum for the current PWM frequency. Note: The number of available PWM steps can be lower than 100 with (very) high PWM frequencies. Note: pin_CCP4_direction should be set to output!
pwm4_set_dutycycle(byte in duty)
Set dutycycle for 10-bits resolution but allowing only 255 PWM steps. This procedure is equivalent to pwm4_set_dutycycle_highres(), but the low order 2 bits of the 10-bits duty cycle are set to 0. This means that only every 4th of the available 1023 steps can be selected and consequently max 255 PWM steps are available. This procedure is for user convenience, allowing to specify an 8 bits value for the duty cycle is for many applications satisfactory. Calling this procedure will also activate PWM. Note: pin_CCP4_direction should be set to output!
pwm4_set_dutycycle_highres(word in duty)
Set dutycycle with 10-bits resolution, allowing 1024 PWM steps. The 'duty' argument is a (max) 10-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<9:2> are the 8 MSbits Allowed range: 0..1023 Note: pin_CCP4_direction should be set to output!
Author | Stef Mientki, Copyright (C) 2002-2006, all rights reserved. |
Adapted-by | Sebastien Lelong, Rob Hamerling. |
Compiler | 2.4l |
Performs PWM operations on the CCP5 module. This file is automatically included by pwm_hardware.jal when the target PIC has a CCP5 module.
1. This is a heavy refactoring of the original pwm_hardware.jal (Stef's lib) 2. Partly rewritten for JalV2 version 2.4l and Jallib revision 1171. Reduced memory occupation. Added procedure for lowres PWM.
No dependency found
var byte _ccpr5l_shadow = 0
var bit*2 _ccp5con_shadow_dc5b at _ccp5con_shadow : 4
var byte _ccp5con_shadow = 0b0000_0000
var bit*4 _ccp5con_shadow_ccp5m at _ccp5con_shadow : 0
pwm5_set_dutycycle_highres(word in duty)
pwm5_set_dutycycle(byte in duty)
pwm5_off()
pwm5_set_dutycycle_lowres(byte in duty)
pwm5_set_percent_dutycycle(byte in percent)
pwm5_on()
var byte _ccpr5l_shadow = 0
8 MSbits of duty cycle
var bit*2 _ccp5con_shadow_dc5b at _ccp5con_shadow : 4
2 LSbits of duty cycle
var byte _ccp5con_shadow = 0b0000_0000
shadow
var bit*4 _ccp5con_shadow_ccp5m at _ccp5con_shadow : 0
mode pattern
pwm5_set_dutycycle_highres(word in duty)
Set dutycycle with 10-bits resolution, allowing 1024 PWM steps. The 'duty' argument is a (max) 10-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<9:2> are the 8 MSbits Allowed range: 0..1023 Note: pin_CCP5_direction should be set to output!
pwm5_set_dutycycle(byte in duty)
Set dutycycle for 10-bits resolution but allowing only 255 PWM steps. This procedure is equivalent to pwm5_set_dutycycle_highres(), but the low order 2 bits of the 10-bits duty cycle are set to 0. This means that only every 4th of the available 1023 steps can be selected and consequently max 255 PWM steps are available. This procedure is for user convenience, allowing to specify an 8 bits value for the duty cycle is for many applications satisfactory. Calling this procedure will also activate PWM. Note: pin_CCP5_direction should be set to output!
pwm5_off()
PWM mode off retain duty cycle setting in shadow registers
pwm5_set_dutycycle_lowres(byte in duty)
Set dutycycle with 8-bits resolution allowing 255 PWM steps. The 'duty' argument is the 8-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<7:2> are the 6 MSbits Allowed range: 0..255 Beware that steps 256..1023 are not available. In other words the available PWM range is 25% of the highres procedure. This procedure is particularly suitable with higher frequencies whereby the PWM resolution is limited to 256 steps or less!
pwm5_set_percent_dutycycle(byte in percent)
Set a percentage duty cycle, allowing max 100 PWM steps. Allowed range: 0..100 The duty cycle will be set to the specified percentage of the maximum for the current PWM frequency. Note: The number of available PWM steps can be lower than 100 with (very) high PWM frequencies. Note: pin_CCP5_direction should be set to output!
pwm5_on()
PWM mode on Restore duty cycle from shadow registers Note: pin_CCP5_direction should be set to output!
Author | Stef Mientki, Copyright (C) 2002-2006, all rights reserved. |
Adapted-by | Sebastien Lelong, Rob Hamerling. |
Compiler | 2.4l |
Performs PWM operations on the CCP6 module. This file is automatically included by pwm_hardware.jal when the target PIC has a CCP6 module.
1. This is a heavy refactoring of the original pwm_hardware.jal (Stef's lib) 2. Partly rewritten for JalV2 version 2.4l and Jallib revision 1171. Reduced memory occupation. Added procedure for lowres PWM.
No dependency found
var bit*2 _ccp6con_shadow_dc6b at _ccp6con_shadow : 4
var bit*4 _ccp6con_shadow_ccp6m at _ccp6con_shadow : 0
var byte _ccp6con_shadow = 0b0000_0000
var byte _ccpr6l_shadow = 0
pwm6_set_dutycycle_highres(word in duty)
pwm6_on()
pwm6_set_dutycycle_lowres(byte in duty)
pwm6_set_dutycycle(byte in duty)
pwm6_set_percent_dutycycle(byte in percent)
pwm6_off()
var bit*2 _ccp6con_shadow_dc6b at _ccp6con_shadow : 4
2 LSbits of duty cycle
var bit*4 _ccp6con_shadow_ccp6m at _ccp6con_shadow : 0
mode pattern
var byte _ccp6con_shadow = 0b0000_0000
shadow
var byte _ccpr6l_shadow = 0
8 MSbits of duty cycle
pwm6_set_dutycycle_highres(word in duty)
Set dutycycle with 10-bits resolution, allowing 1024 PWM steps. The 'duty' argument is a (max) 10-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<9:2> are the 8 MSbits Allowed range: 0..1023 Note: pin_CCP6_direction should be set to output!
pwm6_on()
PWM mode on Restore duty cycle from shadow registers Note: pin_CCP6_direction should be set to output!
pwm6_set_dutycycle_lowres(byte in duty)
Set dutycycle with 8-bits resolution allowing 255 PWM steps. The 'duty' argument is the 8-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<7:2> are the 6 MSbits Allowed range: 0..255 Beware that steps 256..1023 are not available. In other words the available PWM range is 25% of the highres procedure. This procedure is particularly suitable with higher frequencies whereby the PWM resolution is limited to 256 steps or less!
pwm6_set_dutycycle(byte in duty)
Set dutycycle for 10-bits resolution but allowing only 255 PWM steps. This procedure is equivalent to pwm6_set_dutycycle_highres(), but the low order 2 bits of the 10-bits duty cycle are set to 0. This means that only every 4th of the available 1023 steps can be selected and consequently max 255 PWM steps are available. This procedure is for user convenience, allowing to specify an 8 bits value for the duty cycle is for many applications satisfactory. Calling this procedure will also activate PWM. Note: pin_CCP6_direction should be set to output!
pwm6_set_percent_dutycycle(byte in percent)
Set a percentage duty cycle, allowing max 100 PWM steps. Allowed range: 0..100 The duty cycle will be set to the specified percentage of the maximum for the current PWM frequency. Note: The number of available PWM steps can be lower than 100 with (very) high PWM frequencies. Note: pin_CCP6_direction should be set to output!
pwm6_off()
PWM mode off retain duty cycle setting in shadow registers
Author | Stef Mientki, Copyright (C) 2002-2006, all rights reserved. |
Adapted-by | Sebastien Lelong, Rob Hamerling. |
Compiler | 2.4l |
Performs PWM operations on the CCP7 module. This file is automatically included by pwm_hardware.jal when the target PIC has a CCP7 module.
1. This is a heavy refactoring of the original pwm_hardware.jal (Stef's lib) 2. Partly rewritten for JalV2 version 2.4l and Jallib revision 1171. Reduced memory occupation. Added procedure for lowres PWM.
No dependency found
var bit*4 _ccp7con_shadow_ccp7m at _ccp7con_shadow : 0
var bit*2 _ccp7con_shadow_dc7b at _ccp7con_shadow : 4
var byte _ccpr7l_shadow = 0
var byte _ccp7con_shadow = 0b0000_0000
pwm7_on()
pwm7_set_dutycycle_lowres(byte in duty)
pwm7_set_percent_dutycycle(byte in percent)
pwm7_off()
pwm7_set_dutycycle_highres(word in duty)
pwm7_set_dutycycle(byte in duty)
var bit*4 _ccp7con_shadow_ccp7m at _ccp7con_shadow : 0
mode pattern
var bit*2 _ccp7con_shadow_dc7b at _ccp7con_shadow : 4
2 LSbits of duty cycle
var byte _ccpr7l_shadow = 0
8 MSbits of duty cycle
var byte _ccp7con_shadow = 0b0000_0000
shadow
pwm7_on()
PWM mode on Restore duty cycle from shadow registers Note: pin_CCP7_direction should be set to output!
pwm7_set_dutycycle_lowres(byte in duty)
Set dutycycle with 8-bits resolution allowing 255 PWM steps. The 'duty' argument is the 8-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<7:2> are the 6 MSbits Allowed range: 0..255 Beware that steps 256..1023 are not available. In other words the available PWM range is 25% of the highres procedure. This procedure is particularly suitable with higher frequencies whereby the PWM resolution is limited to 256 steps or less!
pwm7_set_percent_dutycycle(byte in percent)
Set a percentage duty cycle, allowing max 100 PWM steps. Allowed range: 0..100 The duty cycle will be set to the specified percentage of the maximum for the current PWM frequency. Note: The number of available PWM steps can be lower than 100 with (very) high PWM frequencies. Note: pin_CCP7_direction should be set to output!
pwm7_off()
PWM mode off retain duty cycle setting in shadow registers
pwm7_set_dutycycle_highres(word in duty)
Set dutycycle with 10-bits resolution, allowing 1024 PWM steps. The 'duty' argument is a (max) 10-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<9:2> are the 8 MSbits Allowed range: 0..1023 Note: pin_CCP7_direction should be set to output!
pwm7_set_dutycycle(byte in duty)
Set dutycycle for 10-bits resolution but allowing only 255 PWM steps. This procedure is equivalent to pwm7_set_dutycycle_highres(), but the low order 2 bits of the 10-bits duty cycle are set to 0. This means that only every 4th of the available 1023 steps can be selected and consequently max 255 PWM steps are available. This procedure is for user convenience, allowing to specify an 8 bits value for the duty cycle is for many applications satisfactory. Calling this procedure will also activate PWM. Note: pin_CCP7_direction should be set to output!
Author | Stef Mientki, Copyright (C) 2002-2006, all rights reserved. |
Adapted-by | Sebastien Lelong, Rob Hamerling. |
Compiler | 2.4l |
Performs PWM operations on the CCP8 module. This file is automatically included by pwm_hardware.jal when the target PIC has a CCP8 module.
1. This is a heavy refactoring of the original pwm_hardware.jal (Stef's lib) 2. Partly rewritten for JalV2 version 2.4l and Jallib revision 1171. Reduced memory occupation. Added procedure for lowres PWM.
No dependency found
var byte _ccp8con_shadow = 0b0000_0000
var byte _ccpr8l_shadow = 0
var bit*4 _ccp8con_shadow_ccp8m at _ccp8con_shadow : 0
var bit*2 _ccp8con_shadow_dc8b at _ccp8con_shadow : 4
pwm8_set_dutycycle(byte in duty)
pwm8_off()
pwm8_on()
pwm8_set_dutycycle_lowres(byte in duty)
pwm8_set_dutycycle_highres(word in duty)
pwm8_set_percent_dutycycle(byte in percent)
var byte _ccp8con_shadow = 0b0000_0000
shadow
var byte _ccpr8l_shadow = 0
8 MSbits of duty cycle
var bit*4 _ccp8con_shadow_ccp8m at _ccp8con_shadow : 0
mode pattern
var bit*2 _ccp8con_shadow_dc8b at _ccp8con_shadow : 4
2 LSbits of duty cycle
pwm8_set_dutycycle(byte in duty)
Set dutycycle for 10-bits resolution but allowing only 255 PWM steps. This procedure is equivalent to pwm8_set_dutycycle_highres(), but the low order 2 bits of the 10-bits duty cycle are set to 0. This means that only every 4th of the available 1023 steps can be selected and consequently max 255 PWM steps are available. This procedure is for user convenience, allowing to specify an 8 bits value for the duty cycle is for many applications satisfactory. Calling this procedure will also activate PWM. Note: pin_CCP8_direction should be set to output!
pwm8_off()
PWM mode off retain duty cycle setting in shadow registers
pwm8_on()
PWM mode on Restore duty cycle from shadow registers Note: pin_CCP8_direction should be set to output!
pwm8_set_dutycycle_lowres(byte in duty)
Set dutycycle with 8-bits resolution allowing 255 PWM steps. The 'duty' argument is the 8-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<7:2> are the 6 MSbits Allowed range: 0..255 Beware that steps 256..1023 are not available. In other words the available PWM range is 25% of the highres procedure. This procedure is particularly suitable with higher frequencies whereby the PWM resolution is limited to 256 steps or less!
pwm8_set_dutycycle_highres(word in duty)
Set dutycycle with 10-bits resolution, allowing 1024 PWM steps. The 'duty' argument is a (max) 10-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<9:2> are the 8 MSbits Allowed range: 0..1023 Note: pin_CCP8_direction should be set to output!
pwm8_set_percent_dutycycle(byte in percent)
Set a percentage duty cycle, allowing max 100 PWM steps. Allowed range: 0..100 The duty cycle will be set to the specified percentage of the maximum for the current PWM frequency. Note: The number of available PWM steps can be lower than 100 with (very) high PWM frequencies. Note: pin_CCP8_direction should be set to output!
Author | Stef Mientki, Copyright (C) 2002-2006, all rights reserved. |
Adapted-by | Sebastien Lelong, Rob Hamerling. |
Compiler | 2.4l |
Performs PWM operations on the CCP9 module. This file is automatically included by pwm_hardware.jal when the target PIC has a CCP9 module.
1. This is a heavy refactoring of the original pwm_hardware.jal (Stef's lib) 2. Partly rewritten for JalV2 version 2.4l and Jallib revision 1171. Reduced memory occupation. Added procedure for lowres PWM.
No dependency found
var bit*4 _ccp9con_shadow_ccp9m at _ccp9con_shadow : 0
var byte _ccpr9l_shadow = 0
var bit*2 _ccp9con_shadow_dc9b at _ccp9con_shadow : 4
var byte _ccp9con_shadow = 0b0000_0000
pwm9_set_dutycycle(byte in duty)
pwm9_set_percent_dutycycle(byte in percent)
pwm9_set_dutycycle_highres(word in duty)
pwm9_on()
pwm9_off()
pwm9_set_dutycycle_lowres(byte in duty)
var bit*4 _ccp9con_shadow_ccp9m at _ccp9con_shadow : 0
mode pattern
var byte _ccpr9l_shadow = 0
8 MSbits of duty cycle
var bit*2 _ccp9con_shadow_dc9b at _ccp9con_shadow : 4
2 LSbits of duty cycle
var byte _ccp9con_shadow = 0b0000_0000
shadow
pwm9_set_dutycycle(byte in duty)
Set dutycycle for 10-bits resolution but allowing only 255 PWM steps. This procedure is equivalent to pwm9_set_dutycycle_highres(), but the low order 2 bits of the 10-bits duty cycle are set to 0. This means that only every 4th of the available 1023 steps can be selected and consequently max 255 PWM steps are available. This procedure is for user convenience, allowing to specify an 8 bits value for the duty cycle is for many applications satisfactory. Calling this procedure will also activate PWM. Note: pin_CCP9_direction should be set to output!
pwm9_set_percent_dutycycle(byte in percent)
Set a percentage duty cycle, allowing max 100 PWM steps. Allowed range: 0..100 The duty cycle will be set to the specified percentage of the maximum for the current PWM frequency. Note: The number of available PWM steps can be lower than 100 with (very) high PWM frequencies. Note: pin_CCP9_direction should be set to output!
pwm9_set_dutycycle_highres(word in duty)
Set dutycycle with 10-bits resolution, allowing 1024 PWM steps. The 'duty' argument is a (max) 10-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<9:2> are the 8 MSbits Allowed range: 0..1023 Note: pin_CCP9_direction should be set to output!
pwm9_on()
PWM mode on Restore duty cycle from shadow registers Note: pin_CCP9_direction should be set to output!
pwm9_off()
PWM mode off retain duty cycle setting in shadow registers
pwm9_set_dutycycle_lowres(byte in duty)
Set dutycycle with 8-bits resolution allowing 255 PWM steps. The 'duty' argument is the 8-bits absolute value for the duty cycle: * duty<1:0> are the 2 LSbits * duty<7:2> are the 6 MSbits Allowed range: 0..255 Beware that steps 256..1023 are not available. In other words the available PWM range is 25% of the highres procedure. This procedure is particularly suitable with higher frequencies whereby the PWM resolution is limited to 256 steps or less!
Author | Stef Mientki, Copyright (C) 2002-2006, all rights reserved. |
Adapted-by | Sebastien Lelong |
Compiler | 2.4l |
This lib handles common operations on PWM, regardless the channel number. It is used in combination with one or more pwm_ccplibraries (eg. pwm_ccp1.jal, pwm_ccp2.jal, etc.). These libraries are included automatically dependent of the configuration of the target PIC.
This is a heavy refactoring of the original pwm_hardware.jal (Stef's lib).
No dependency found
var volatile word _pr2_shadow_plus1 = 256
Shadow of PR2 (value incremented by 1, i.e. value in range 1..256)
pwm_max_resolution(byte in prescaler)
Sets all(!) CCP modules for max (10-bits) PWM resolution. While setting maximum resolution, the Timer2 prescaler can be used to adjust frequency to a some extent with the Timer2 parameter value which can be either: * 1 : high frequency * 4 : medium frequency * 16: low frequency Below a table showing the PWM frequencies for common clock speeds and different Timer2 prescaler values. ||*Timer2 prescaler* || *4MHz* || *8MHz* || *10MHz* || *20MHz* || || 1 || 3.90 kHz || 7.81 kHz || 9.77 kHz || 19.43 kHz || || 4 || 976 Hz || 1.95 kHz || 2.44 kHz || 4.88 kHz || || 16 || 244 Hz || 488 Hz || 610 Hz || 1.22 kHz || For PICs with more than one CCP module you should realize that all CCP modules use Timer2 and PR2 for PWM operations. This means that the PWM period (frequency) of all PWM output pins is the same. Only the duty cycle can vary between one and another PWM pin. Set PWM to maximum resolution (for all PWM pins!). This implies 1 out of 3 specific PWM frequencies, depending on the Timer2 prescaler value passed with the call. See examples in the table above, or use the formula in the datasheet to calculate the resulting frequency.
pwm_set_frequency(dword in freq)
Sets all(!) CCP modules for a specific PWM frequency. The minimum and maximum allowed PWM frequencies depend on the clock speed. When specifying a value beyond the limits PWM will not be started. The chosen frequency may enforce a limit on the PWM resolution (number of steps). The application program should not specify a higher value for the duty cycle than this limit. When exceeding this limit the dutycycle will probably result in a 'weird' value. Only the procedure set_dutycycle_percent() is safe in this case, the other set_dutycycle procedures use absolute values and are not safe!
Author | Sebastien Lelong, Copyright (C) 2008-2009, all rights reserved. |
Adapted-by | Albert Faber, Rob Hamerling. |
Compiler | 2.4l |
Include this library if you want to use the PWM feature of the CCP module(s). This library uses conditional compile to selectively include underlying PWM libraries and number of PWM channels, according to the target PIC configuration. Ex: - 16f88 has 1 PWM channel: including pwm_hardware will prepare PWM for 1 channel (using pwm_ccp1.jal) - 16f877 has 2 PWM channels: including pwm_hardware will prepare PWM for 2 channels (using pwm_ccp1.jal and pwm_ccp2.jal) - etc. for PICs with more CCP modules Note: All used pin_CCPx_directions should be set to output by the application. With using the PWM hardware a design choice must be made between desired PWM frequency and desired PWM resolution (number of possible PWM steps). Choosing maximum PWM resolution implies a relative low PWM frequency and vice versa: a high frequency limits the number of available PWM steps. The figures are dependent on the target clock speed. Refer to pwm_common, pwm_ccp1, pwm_ccp2 ... etc. documentation to understand how to use these PWM libraries.
1. Because the PWM libraries use conditional compilation and the 'alias' keyword, at least JalV2 compiler version 2.4l is required. 2. These libraries use the pin alias names as declared in Jallib device files since revision 1171, so Jallib release 0.4 is a minimum requirement. 3. Some PICs have extended CCP modules. These will be handled by these PWM libraries as 'classic' CCP modules.
Author | Joep Suijs, Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4i |
this library provides a (one) byte fifo queue. This queue is interrupt-safe in the sense that you can write to the queue from the interrupt and read from the main program or vice versa without special precautions. Reading (or writing) from both interrupt and main program might not work properly. The basic interface is pseudo var: queue01 = x -- put x into queue; block if queue is full x = queue01 -- read x from queue; block if queue is empty non-blocking access to the same queue is provided by queue01_nb_put() and queue01_nb_get() other methods: queue01_clear() -- clear queue (makes queue empty) queue01_empty() -- returns true if queue is emtpy (depricated, use queue1_is_empty()) queue01_is_empty() -- returns true if queue is emtpy queue01_is_full() -- returns true if queue is full queue01_nr_free() -- returns nr of free places in queue queue01_nr_used() -- returns nr of used places in queue Option: const queue01_element_size = n ; define Queue elements are n bytes wide (default is one byte)
No dependency found
var volatile byte queue01_out_pointer = 0 ; wijst naar databyte
var volatile byte*queue01_element_size queue01_data[queue01_size + 1]
var volatile byte queue01_in_pointer = 0 ; wijst naar vrije locatie
queue01_nb'put(byte*queue01_element_size in v)
queue01'put(byte*queue01_element_size in v)
queue01_clear()
queue01_nb_put(byte*queue01_element_size in v) return bit
queue01_nb'get() return byte*queue01_element_size
queue01_empty() return bit
queue01_is_empty() return bit
queue01_nr_used() return byte
queue01_is_full() return bit
queue01_nr_free() return byte
queue01_nb_get(byte*queue01_element_size out v) return bit
queue01'get() return byte*queue01_element_size
var volatile byte queue01_out_pointer = 0 ; wijst naar databyte
No documentation found
var volatile byte*queue01_element_size queue01_data[queue01_size + 1]
queue vars
var volatile byte queue01_in_pointer = 0 ; wijst naar vrije locatie
No documentation found
queue01_nb'put(byte*queue01_element_size in v)
queue01_nb'put - put one byte into queue (non-blocking)
queue01'put(byte*queue01_element_size in v)
queue01'put - put one byte into queue When the queue is full, it waits until a byte is removed from the queue.
queue01_clear()
deprecated
queue01_nb_put(byte*queue01_element_size in v) return bit
queue01_nb_put - put one byte into queue (non-blocking) return: true when the byte is put into the queue false when the queue is full (byte is not put in queue)
queue01_nb'get() return byte*queue01_element_size
queue01_nb'get - get one byte from queue (non-blocking) returns byte from queue, 0 if queue empty
queue01_empty() return bit
queue01_is_empty() return bit
queue01_is_empty() -- returns true if queue is emtpy
queue01_nr_used() return byte
queue01_nr_used - returns nr of used places in queue
queue01_is_full() return bit
queue01_is_full() -- returns true if queue is full
queue01_nr_free() return byte
queue01_nr_free - returns nr of free places in queue
queue01_nb_get(byte*queue01_element_size out v) return bit
queue01_nb_get - get one byte from queue (non-blocking) The byte read is put into v (calling param) returns: true when we read a byte from the queue false when the queue is empty (byte is not read from queue)
queue01'get() return byte*queue01_element_size
queue01'get - get one byte from queue returns byte from queue. When the queue is empty, it waits until a byte is put into the queue.
Author | Joep Suijs, Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4i |
this library provides a (one) byte fifo queue. This queue is interrupt-safe in the sense that you can write to the queue from the interrupt and read from the main program or vice versa without special precautions. Reading (or writing) from both interrupt and main program might not work properly. The basic interface is pseudo var: queue02 = x -- put x into queue; block if queue is full x = queue02 -- read x from queue; block if queue is empty non-blocking access to the same queue is provided by queue02_nb_put() and queue02_nb_get() other methods: queue02_clear() -- clear queue (makes queue empty) queue02_empty() -- returns true if queue is emtpy (depricated, use queue1_is_empty()) queue02_is_empty() -- returns true if queue is emtpy queue02_is_full() -- returns true if queue is full queue02_nr_free() -- returns nr of free places in queue queue02_nr_used() -- returns nr of used places in queue
No dependency found
var volatile byte queue02_out_pointer = 0 ; wijst naar databyte
var volatile byte queue02_data[queue02_size + 1]
var volatile byte queue02_in_pointer = 0 ; wijst naar vrije locatie
queue02_is_full() return bit
queue02_empty() return bit
queue02'get() return byte
queue02_nb'get() return byte
queue02_is_empty() return bit
queue02_nb_get(byte out v) return bit
queue02_nb_put(byte in v) return bit
queue02_nr_used() return byte
queue02_nr_free() return byte
var volatile byte queue02_out_pointer = 0 ; wijst naar databyte
No documentation found
var volatile byte queue02_data[queue02_size + 1]
queue vars
var volatile byte queue02_in_pointer = 0 ; wijst naar vrije locatie
No documentation found
queue02_nb'put(byte in v)
queue02_nb'put - put one byte into queue (non-blocking)
queue02_clear()
deprecated
queue02'put(byte in v)
queue02'put - put one byte into queue When the queue is full, it waits until a byte is removed from the queue.
queue02_is_full() return bit
queue02_is_full() -- returns true if queue is full
queue02_empty() return bit
queue02'get() return byte
queue02'get - get one byte from queue returns byte from queue. When the queue is empty, it waits until a byte is put into the queue.
queue02_nb'get() return byte
queue02_nb'get - get one byte from queue (non-blocking) returns byte from queue, 0 if queue empty
queue02_is_empty() return bit
queue02_is_empty() -- returns true if queue is emtpy
queue02_nb_get(byte out v) return bit
queue02_nb_get - get one byte from queue (non-blocking) The byte read is put into v (calling param) returns: true when we read a byte from the queue false when the queue is empty (byte is not read from queue)
queue02_nb_put(byte in v) return bit
queue02_nb_put - put one byte into queue (non-blocking) return: true when the byte is put into the queue false when the queue is full (byte is not put in queue)
queue02_nr_used() return byte
queue02_nr_used - returns nr of used places in queue
queue02_nr_free() return byte
queue02_nr_free - returns nr of free places in queue
Author | Joep Suijs, Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4i |
this library provides a (one) byte fifo queue. This queue is interrupt-safe in the sense that you can write to the queue from the interrupt and read from the main program or vice versa without special precautions. Reading (or writing) from both interrupt and main program might not work properly. The basic interface is pseudo var: queue03 = x -- put x into queue; block if queue is full x = queue03 -- read x from queue; block if queue is empty non-blocking access to the same queue is provided by queue03_nb_put() and queue03_nb_get() other methods: queue03_clear() -- clear queue (makes queue empty) queue03_empty() -- returns true if queue is emtpy (depricated, use queue1_is_empty()) queue03_is_empty() -- returns true if queue is emtpy queue03_is_full() -- returns true if queue is full queue03_nr_free() -- returns nr of free places in queue queue03_nr_used() -- returns nr of used places in queue
No dependency found
var volatile byte queue03_in_pointer = 0 ; wijst naar vrije locatie
var volatile byte queue03_data[queue03_size + 1]
var volatile byte queue03_out_pointer = 0 ; wijst naar databyte
queue03_nr_free() return byte
queue03'get() return byte
queue03_nr_used() return byte
queue03_nb_put(byte in v) return bit
queue03_is_full() return bit
queue03_nb'get() return byte
queue03_nb_get(byte out v) return bit
queue03_is_empty() return bit
queue03_empty() return bit
var volatile byte queue03_in_pointer = 0 ; wijst naar vrije locatie
No documentation found
var volatile byte queue03_data[queue03_size + 1]
queue vars
var volatile byte queue03_out_pointer = 0 ; wijst naar databyte
No documentation found
queue03'put(byte in v)
queue03'put - put one byte into queue When the queue is full, it waits until a byte is removed from the queue.
queue03_clear()
deprecated
queue03_nb'put(byte in v)
queue03_nb'put - put one byte into queue (non-blocking)
queue03_nr_free() return byte
queue03_nr_free - returns nr of free places in queue
queue03'get() return byte
queue03'get - get one byte from queue returns byte from queue. When the queue is empty, it waits until a byte is put into the queue.
queue03_nr_used() return byte
queue03_nr_used - returns nr of used places in queue
queue03_nb_put(byte in v) return bit
queue03_nb_put - put one byte into queue (non-blocking) return: true when the byte is put into the queue false when the queue is full (byte is not put in queue)
queue03_is_full() return bit
queue03_is_full() -- returns true if queue is full
queue03_nb'get() return byte
queue03_nb'get - get one byte from queue (non-blocking) returns byte from queue, 0 if queue empty
queue03_nb_get(byte out v) return bit
queue03_nb_get - get one byte from queue (non-blocking) The byte read is put into v (calling param) returns: true when we read a byte from the queue false when the queue is empty (byte is not read from queue)
queue03_is_empty() return bit
queue03_is_empty() -- returns true if queue is emtpy
queue03_empty() return bit
Author | Joep Suijs, Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4i |
this library provides a (one) byte fifo queue. This queue is interrupt-safe in the sense that you can write to the queue from the interrupt and read from the main program or vice versa without special precautions. Reading (or writing) from both interrupt and main program might not work properly. The basic interface is pseudo var: queue04 = x -- put x into queue; block if queue is full x = queue04 -- read x from queue; block if queue is empty non-blocking access to the same queue is provided by queue04_nb_put() and queue04_nb_get() other methods: queue04_clear() -- clear queue (makes queue empty) queue04_empty() -- returns true if queue is emtpy (depricated, use queue1_is_empty()) queue04_is_empty() -- returns true if queue is emtpy queue04_is_full() -- returns true if queue is full queue04_nr_free() -- returns nr of free places in queue queue04_nr_used() -- returns nr of used places in queue
No dependency found
var volatile byte queue04_in_pointer = 0 ; wijst naar vrije locatie
var volatile byte queue04_data[queue04_size + 1]
var volatile byte queue04_out_pointer = 0 ; wijst naar databyte
queue04_nr_free() return byte
queue04_empty() return bit
queue04_is_full() return bit
queue04_nb'get() return byte
queue04_nr_used() return byte
queue04_is_empty() return bit
queue04_nb_get(byte out v) return bit
queue04'get() return byte
queue04_nb_put(byte in v) return bit
var volatile byte queue04_in_pointer = 0 ; wijst naar vrije locatie
No documentation found
var volatile byte queue04_data[queue04_size + 1]
queue vars
var volatile byte queue04_out_pointer = 0 ; wijst naar databyte
No documentation found
queue04'put(byte in v)
queue04'put - put one byte into queue When the queue is full, it waits until a byte is removed from the queue.
queue04_nb'put(byte in v)
queue04_nb'put - put one byte into queue (non-blocking)
queue04_clear()
deprecated
queue04_nr_free() return byte
queue04_nr_free - returns nr of free places in queue
queue04_empty() return bit
queue04_is_full() return bit
queue04_is_full() -- returns true if queue is full
queue04_nb'get() return byte
queue04_nb'get - get one byte from queue (non-blocking) returns byte from queue, 0 if queue empty
queue04_nr_used() return byte
queue04_nr_used - returns nr of used places in queue
queue04_is_empty() return bit
queue04_is_empty() -- returns true if queue is emtpy
queue04_nb_get(byte out v) return bit
queue04_nb_get - get one byte from queue (non-blocking) The byte read is put into v (calling param) returns: true when we read a byte from the queue false when the queue is empty (byte is not read from queue)
queue04'get() return byte
queue04'get - get one byte from queue returns byte from queue. When the queue is empty, it waits until a byte is put into the queue.
queue04_nb_put(byte in v) return bit
queue04_nb_put - put one byte into queue (non-blocking) return: true when the byte is put into the queue false when the queue is full (byte is not put in queue)
Author | Joep Suijs, Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4i |
this library provides a (one) byte fifo queue. This queue is interrupt-safe in the sense that you can write to the queue from the interrupt and read from the main program or vice versa without special precautions. Reading (or writing) from both interrupt and main program might not work properly. The basic interface is pseudo var: queue05 = x -- put x into queue; block if queue is full x = queue05 -- read x from queue; block if queue is empty non-blocking access to the same queue is provided by queue05_nb_put() and queue05_nb_get() other methods: queue05_clear() -- clear queue (makes queue empty) queue05_empty() -- returns true if queue is emtpy (depricated, use queue1_is_empty()) queue05_is_empty() -- returns true if queue is emtpy queue05_is_full() -- returns true if queue is full queue05_nr_free() -- returns nr of free places in queue queue05_nr_used() -- returns nr of used places in queue
No dependency found
var volatile byte queue05_out_pointer = 0 ; wijst naar databyte
var volatile byte queue05_in_pointer = 0 ; wijst naar vrije locatie
var volatile byte queue05_data[queue05_size + 1]
queue05_nr_free() return byte
queue05_nb'get() return byte
queue05_is_empty() return bit
queue05_nb_put(byte in v) return bit
queue05_nr_used() return byte
queue05_is_full() return bit
queue05_empty() return bit
queue05_nb_get(byte out v) return bit
queue05'get() return byte
var volatile byte queue05_out_pointer = 0 ; wijst naar databyte
No documentation found
var volatile byte queue05_in_pointer = 0 ; wijst naar vrije locatie
No documentation found
var volatile byte queue05_data[queue05_size + 1]
queue vars
queue05_clear()
deprecated
queue05_nb'put(byte in v)
queue05_nb'put - put one byte into queue (non-blocking)
queue05'put(byte in v)
queue05'put - put one byte into queue When the queue is full, it waits until a byte is removed from the queue.
queue05_nr_free() return byte
queue05_nr_free - returns nr of free places in queue
queue05_nb'get() return byte
queue05_nb'get - get one byte from queue (non-blocking) returns byte from queue, 0 if queue empty
queue05_is_empty() return bit
queue05_is_empty() -- returns true if queue is emtpy
queue05_nb_put(byte in v) return bit
queue05_nb_put - put one byte into queue (non-blocking) return: true when the byte is put into the queue false when the queue is full (byte is not put in queue)
queue05_nr_used() return byte
queue05_nr_used - returns nr of used places in queue
queue05_is_full() return bit
queue05_is_full() -- returns true if queue is full
queue05_empty() return bit
queue05_nb_get(byte out v) return bit
queue05_nb_get - get one byte from queue (non-blocking) The byte read is put into v (calling param) returns: true when we read a byte from the queue false when the queue is empty (byte is not read from queue)
queue05'get() return byte
queue05'get - get one byte from queue returns byte from queue. When the queue is empty, it waits until a byte is put into the queue.
Author | Joep Suijs, Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4i |
this library provides a (one) byte fifo queue. This queue is interrupt-safe in the sense that you can write to the queue from the interrupt and read from the main program or vice versa without special precautions. Reading (or writing) from both interrupt and main program might not work properly. The basic interface is pseudo var: queue06 = x -- put x into queue; block if queue is full x = queue06 -- read x from queue; block if queue is empty non-blocking access to the same queue is provided by queue06_nb_put() and queue06_nb_get() other methods: queue06_clear() -- clear queue (makes queue empty) queue06_empty() -- returns true if queue is emtpy (depricated, use queue1_is_empty()) queue06_is_empty() -- returns true if queue is emtpy queue06_is_full() -- returns true if queue is full queue06_nr_free() -- returns nr of free places in queue queue06_nr_used() -- returns nr of used places in queue
No dependency found
var volatile byte queue06_in_pointer = 0 ; wijst naar vrije locatie
var volatile byte queue06_data[queue06_size + 1]
var volatile byte queue06_out_pointer = 0 ; wijst naar databyte
queue06_is_empty() return bit
queue06_is_full() return bit
queue06_empty() return bit
queue06_nr_used() return byte
queue06_nb_get(byte out v) return bit
queue06_nb_put(byte in v) return bit
queue06'get() return byte
queue06_nr_free() return byte
queue06_nb'get() return byte
var volatile byte queue06_in_pointer = 0 ; wijst naar vrije locatie
No documentation found
var volatile byte queue06_data[queue06_size + 1]
queue vars
var volatile byte queue06_out_pointer = 0 ; wijst naar databyte
No documentation found
queue06_nb'put(byte in v)
queue06_nb'put - put one byte into queue (non-blocking)
queue06'put(byte in v)
queue06'put - put one byte into queue When the queue is full, it waits until a byte is removed from the queue.
queue06_clear()
deprecated
queue06_is_empty() return bit
queue06_is_empty() -- returns true if queue is emtpy
queue06_is_full() return bit
queue06_is_full() -- returns true if queue is full
queue06_empty() return bit
queue06_nr_used() return byte
queue06_nr_used - returns nr of used places in queue
queue06_nb_get(byte out v) return bit
queue06_nb_get - get one byte from queue (non-blocking) The byte read is put into v (calling param) returns: true when we read a byte from the queue false when the queue is empty (byte is not read from queue)
queue06_nb_put(byte in v) return bit
queue06_nb_put - put one byte into queue (non-blocking) return: true when the byte is put into the queue false when the queue is full (byte is not put in queue)
queue06'get() return byte
queue06'get - get one byte from queue returns byte from queue. When the queue is empty, it waits until a byte is put into the queue.
queue06_nr_free() return byte
queue06_nr_free - returns nr of free places in queue
queue06_nb'get() return byte
queue06_nb'get - get one byte from queue (non-blocking) returns byte from queue, 0 if queue empty
Author | Joep Suijs, Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4i |
this library provides a (one) byte fifo queue. This queue is interrupt-safe in the sense that you can write to the queue from the interrupt and read from the main program or vice versa without special precautions. Reading (or writing) from both interrupt and main program might not work properly. The basic interface is pseudo var: queue07 = x -- put x into queue; block if queue is full x = queue07 -- read x from queue; block if queue is empty non-blocking access to the same queue is provided by queue07_nb_put() and queue07_nb_get() other methods: queue07_clear() -- clear queue (makes queue empty) queue07_empty() -- returns true if queue is emtpy (depricated, use queue1_is_empty()) queue07_is_empty() -- returns true if queue is emtpy queue07_is_full() -- returns true if queue is full queue07_nr_free() -- returns nr of free places in queue queue07_nr_used() -- returns nr of used places in queue
No dependency found
var volatile byte queue07_out_pointer = 0 ; wijst naar databyte
var volatile byte queue07_in_pointer = 0 ; wijst naar vrije locatie
var volatile byte queue07_data[queue07_size + 1]
queue07_is_empty() return bit
queue07_nb'get() return byte
queue07_is_full() return bit
queue07_nb_put(byte in v) return bit
queue07_nr_free() return byte
queue07_empty() return bit
queue07'get() return byte
queue07_nb_get(byte out v) return bit
queue07_nr_used() return byte
var volatile byte queue07_out_pointer = 0 ; wijst naar databyte
No documentation found
var volatile byte queue07_in_pointer = 0 ; wijst naar vrije locatie
No documentation found
var volatile byte queue07_data[queue07_size + 1]
queue vars
queue07'put(byte in v)
queue07'put - put one byte into queue When the queue is full, it waits until a byte is removed from the queue.
queue07_nb'put(byte in v)
queue07_nb'put - put one byte into queue (non-blocking)
queue07_clear()
deprecated
queue07_is_empty() return bit
queue07_is_empty() -- returns true if queue is emtpy
queue07_nb'get() return byte
queue07_nb'get - get one byte from queue (non-blocking) returns byte from queue, 0 if queue empty
queue07_is_full() return bit
queue07_is_full() -- returns true if queue is full
queue07_nb_put(byte in v) return bit
queue07_nb_put - put one byte into queue (non-blocking) return: true when the byte is put into the queue false when the queue is full (byte is not put in queue)
queue07_nr_free() return byte
queue07_nr_free - returns nr of free places in queue
queue07_empty() return bit
queue07'get() return byte
queue07'get - get one byte from queue returns byte from queue. When the queue is empty, it waits until a byte is put into the queue.
queue07_nb_get(byte out v) return bit
queue07_nb_get - get one byte from queue (non-blocking) The byte read is put into v (calling param) returns: true when we read a byte from the queue false when the queue is empty (byte is not read from queue)
queue07_nr_used() return byte
queue07_nr_used - returns nr of used places in queue
Author | Joep Suijs, Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4i |
this library provides a (one) byte fifo queue. This queue is interrupt-safe in the sense that you can write to the queue from the interrupt and read from the main program or vice versa without special precautions. Reading (or writing) from both interrupt and main program might not work properly. The basic interface is pseudo var: queue08 = x -- put x into queue; block if queue is full x = queue08 -- read x from queue; block if queue is empty non-blocking access to the same queue is provided by queue08_nb_put() and queue08_nb_get() other methods: queue08_clear() -- clear queue (makes queue empty) queue08_empty() -- returns true if queue is emtpy (depricated, use queue1_is_empty()) queue08_is_empty() -- returns true if queue is emtpy queue08_is_full() -- returns true if queue is full queue08_nr_free() -- returns nr of free places in queue queue08_nr_used() -- returns nr of used places in queue
No dependency found
var volatile byte queue08_out_pointer = 0 ; wijst naar databyte
var volatile byte queue08_in_pointer = 0 ; wijst naar vrije locatie
var volatile byte queue08_data[queue08_size + 1]
queue08'get() return byte
queue08_is_empty() return bit
queue08_nb'get() return byte
queue08_nr_used() return byte
queue08_is_full() return bit
queue08_empty() return bit
queue08_nb_get(byte out v) return bit
queue08_nr_free() return byte
queue08_nb_put(byte in v) return bit
var volatile byte queue08_out_pointer = 0 ; wijst naar databyte
No documentation found
var volatile byte queue08_in_pointer = 0 ; wijst naar vrije locatie
No documentation found
var volatile byte queue08_data[queue08_size + 1]
queue vars
queue08_nb'put(byte in v)
queue08_nb'put - put one byte into queue (non-blocking)
queue08'put(byte in v)
queue08'put - put one byte into queue When the queue is full, it waits until a byte is removed from the queue.
queue08_clear()
deprecated
queue08'get() return byte
queue08'get - get one byte from queue returns byte from queue. When the queue is empty, it waits until a byte is put into the queue.
queue08_is_empty() return bit
queue08_is_empty() -- returns true if queue is emtpy
queue08_nb'get() return byte
queue08_nb'get - get one byte from queue (non-blocking) returns byte from queue, 0 if queue empty
queue08_nr_used() return byte
queue08_nr_used - returns nr of used places in queue
queue08_is_full() return bit
queue08_is_full() -- returns true if queue is full
queue08_empty() return bit
queue08_nb_get(byte out v) return bit
queue08_nb_get - get one byte from queue (non-blocking) The byte read is put into v (calling param) returns: true when we read a byte from the queue false when the queue is empty (byte is not read from queue)
queue08_nr_free() return byte
queue08_nr_free - returns nr of free places in queue
queue08_nb_put(byte in v) return bit
queue08_nb_put - put one byte into queue (non-blocking) return: true when the byte is put into the queue false when the queue is full (byte is not put in queue)
Author | Joep Suijs, Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4i |
this library provides a (decent) random function. The formula is provided by *the* George Marsaglia. (see http://coding.derkeiler.com/Archive/C_CPP/comp.lang.c/2008-03/msg03691.html) /* initialize with any 32-bit seed x and any 32-bit y not 0 */ static unsigned long x=2282008, y=362436069; #define sK ( x=69069*x+123, y^=y<<13, y^=y>>17, y^=y<<5, x+y ) function random_byte returns an 8-bit random number function random_word returns a 16-bit random number functon dice returns a number from 1 to 6 Note: this library will recreate the same sequence. If this is undesired, assign a different (non-zero!) startup-value to _rndx and/or _rndy at startup. Note2: If you don't care about random quality and want to save a few processor cycles or memory bytes, define random_downgrade to select a basic random algorithm.
Interface Copyright (C) 2005 Stef Mientki
No dependency found
var volatile dword _rndx = 2282008
No documentation found
var byte nr
No documentation found
dice() return byte
dice - return a random number in the range [1..6]
random_word() return word
random_word - return a 16-bit random number
random_byte() return byte
random_byte - return an 8-bit random number
16f648a | 16f648a_random.jal |
16f723 | 16f723_random.jal |
16f73 | 16f73_random.jal |
16f877 | 16f877_glcd_ks0108.jal |
16f877 | 16f877_random.jal |
16f877a | 16f877a_glcd_ks0108.jal |
16f877a | 16f877a_random.jal |
16f88 | 16f88_random.jal |
18f14k50 | 18f14k50_random.jal |
18f2450 | 18f2450_random.jal |
18f4550 | 18f4550_glcd_ks0108.jal |
18f4550 | 18f4550_random.jal |
Author | Eur van Andel, Copyright (c) 2003..2008, all rights reserved. |
Adapted-by | Rob Hamerling |
Compiler | 2.4l |
This Interrupt Service Routine updates the variable seconds about once per second. The precision is 0.2 ppm, the accuracy depends on the Xtal used.
http://www.romanblack.com/one_sec.htm http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
This is the Bresenham Line Algorithm, invented at IBM in 1962, which gets an accurate end result by summing the small errors resulting of taking discrete steps and correcting when the error gets too large. This means that individual second lengths may show some jitter, but that long-term timekeeping is accurate. Original assembler by Roman Black. . At 20 MHz, so 200ns/clock, so 5 000 000 clocks/second Rhe RTC has three bytes: bres_hi, bres_mid, bres_lo timer 0 runs on internal clock speed and interrupts on overflow every timer 0 interrupt decreases bres_mid by one. The 5 000 000 value is added when bres_hi en bres_mid are zero note that remainder is added to bres_lo, which can overflow in bres_mid this keeps clock count accurate, although interrupts happen every 256 clock counts the ISR subtracts 1 from the mid byte. It first checks the mid byte for zero and borrows a bit from bres_hi if needed. . Required PIC settings: T0CON_PSA = 1 T0CON_PS = 0 T0CON_T0CS = 0 -- Timer0 on instruction cycle clock
No dependency found
const _rtc_cycles_per_second = (target_clock / 4)
const byte _rtc_mid = _rtc_cycles_per_second % 65536 / 256
var volatile byte _rtc_bres_hi = _rtc_hi
var volatile byte seconds
var volatile byte _rtc_bres_lo = _rtc_lo
const byte _rtc_lo = _rtc_cycles_per_second % 256
var volatile byte _rtc_bres_mid = _rtc_mid
const byte _rtc_hi = _rtc_cycles_per_second / 65536
const _rtc_cycles_per_second = (target_clock / 4)
No documentation found
const byte _rtc_mid = _rtc_cycles_per_second % 65536 / 256
No documentation found
var volatile byte _rtc_bres_hi = _rtc_hi
\
var volatile byte seconds
global variable updated by ISR
var volatile byte _rtc_bres_lo = _rtc_lo
/
const byte _rtc_lo = _rtc_cycles_per_second % 256
No documentation found
var volatile byte _rtc_bres_mid = _rtc_mid
> init 3-byte counter
const byte _rtc_hi = _rtc_cycles_per_second / 65536
No documentation found
RTC()
No documentation found
16f876a | 16f876a_rtc_lcd.jal |
16f877a | 16f877a_rtc_lcd.jal |
16f886 | 16f886_rtc_lcd_4mhz.jal |
16f886 | 16f886_rtc_lcd_20mhz.jal |
16f886 | 16f886_rtc_lcd_125khz.jal |
Author | Eur van Andel, Copyright (c) 2010, all rights reserved. |
Adapted-by | |
Compiler | 2.4m |
This Interrupt Service Routine updates the variable seconds about once per second. The precision is 0.2 ppm, the accuracy depends on the Xtal used. The main program should check if seconds are > 60 and if so, increase minutes, hours, days, months, etc. calendar.jal does this
http://www.romanblack.com/one_sec.htm http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
This is the Bresenham Line Algorithm, invented at IBM in 1962, which gets an accurate end result by summing the small errors resulting of taking discrete steps and correcting when the error gets too large. This means that individual second lengths may show some jitter, but that long-term timekeeping is accurate. . For instance: if xtal=20 MHz, then 5 MHz clock, so 5 000 000 clocks/second TMR3 runs on internal clock speed and interrupts on overflow every TMR3 interrupt decreases _rtc_bresenham by 0x1_00_00, or 2^16 if _rts_bresenham < 0x1_00_00 then 5_000_000 is added so the jitter is 2^15/5e6 = 0.6% Total second count is accurate, since the lower 15 bits stay intact and add up . This RTC runs on TMR3. You must setup TMR3 yourself in the main program. prescaler = 1, internal clock, TMR3 = on TMR3IE = on, INTCON_GIE = on A typical setup looks for a PIC18F look like this: . T3CON_T3CKPS = 0b00 -- 1:1 prescaler T3CON_TMR3_ON = on -- TMR3 on . PIE2_TMR3IE = on -- TMR3 interrupt enabled IPR_TMR3IP = on -- high priority interrupt for TMR3 (default on) RCON_IPEN = off -- no interrupt priorities (default off) INTCON_PEIE = on -- peripheral interrupt enabled INTCON_GIE = on -- global interrupt enabled
No dependency found
var volatile dword _rtc_bresenham = _rtc_cycles_per_second
var volatile byte seconds
const _rtc_cycles_per_second = (target_clock / 4)
var volatile dword _rtc_bresenham = _rtc_cycles_per_second
No documentation found
var volatile byte seconds
global variable updated by ISR
const _rtc_cycles_per_second = (target_clock / 4)
No documentation found
RTC()
No documentation found
18f2620 | 18f2620_rtc_tmr3.jal |
Author | Rob Hamerling, Copyright (c) 2010..2011, all rights reserved. |
Adapted-by | |
Compiler | 2.4n |
RealTimeClock support: - routines for control of realtime clock and alarm . This library supports: - RTCC modules like in 18fxxj11, 18fxxj50 and several other PICs. . Available procedures and functions for application programs (not all of these may be implemented yet!). . Time/clock related operations: - rtc_set_clock() -- enable/disable RTCC module - rtc_calibrate() -- compensate crystal frequency aberration - rtc_pin_signal() -- RTCC output pin signal control - rtc_get_date() -- year,month,day (bcd) - rtc_set_date() - rtc_get_time() -- hour,minute,second (bcd) - rtc_set_time() - rtc_get_secondofday() -- second of day (binary) - rtc_get_minuteofday() -- minute of day (binary) - rtc_get_dayofweek() -- day of week number (binary) - rtc_get_dayofmonth() -- day of month (binary) - rtc_get_dayofyear() -- day of year (binary) . Alarm related operations: - rtc_set_alarm() -- enable/disable alarm - rtc_get_alarm_date() -- alarm month,day (bcd), no year! - rtc_set_alarm_date() - rtc_get_alarm_time() -- alarm hour,minute,second (bcd) - rtc_set_alarm_time() - rtc_set_alarm_dayofweek() - rtc_set_alarm_interval() -- alarm interval (binary) - rtc_set_alarm_repeat() -- alarm repeat (binary) . General purpose functions and procedures: - bcd2bin() -- convert byte from bcd to binary - mult60() -- hours -> minutes; minutes -> seconds . The RTCC uses bcd notation for year, month, day, hour, minute and second (all of these are byte variables). . Bytes in bcd-notation can easily be displayed with print_byte_hex() of the Jallib print library. . For the compare of dates and times (for smaller or larger) the library provides some functions which return binary values for minute or second of the day, day of the week, day of the month and day of the year.
No dependency found
var byte _alrm_sec = 0x00
var byte _rtc_min = 0x00
var byte _rtc_hour = 0x00
var byte _alrm_hour = 0x00
var byte _alrm_month = 0x01
var byte _alrm_dayofweek = 0x00
var byte _alrm_dayofmonth = 0x01
var byte _rtc_year = 0x00
var byte _alrm_min = 0x00
var byte _rtc_dayofmonth = 0x01
var byte _rtc_month = 0x01
var byte _rtc_sec = 0x00
var byte _rtc_dayofweek
rtc_calibrate(sbyte in calibration)
rtc_set_alarm_interval(byte in interval)
rtc_set_alarm_dayofweek(byte in weekday)
rtc_set_alarm(bit in state)
rtc_set_alarm_repeat(byte in repeats)
rtc_pin_signal(bit*2 in pin_signal_selection_mask)
rtc_set_clock(bit in state)
mult60(word in x) return dword
rtc_get_dayofweek() return byte
rtc_get_dayofyear() return word
rtc_get_minuteofday() return word
bcd2bin(byte in bcd) return byte
rtc_get_secondofday() return dword
rtc_get_dayofmonth() return byte
var byte _alrm_sec = 0x00
alarm second
var byte _rtc_min = 0x00
minute
var byte _rtc_hour = 0x00
hour
var byte _alrm_hour = 0x00
alarm hour
var byte _alrm_month = 0x01
alarm month
var byte _alrm_dayofweek = 0x00
alarm day of week
var byte _alrm_dayofmonth = 0x01
alarm day
var byte _rtc_year = 0x00
Global variables internally used by rtcc and alarm functions and procedures. Not to be accessed by application programs!
var byte _alrm_min = 0x00
alarm minute
var byte _rtc_dayofmonth = 0x01
day of month
var byte _rtc_month = 0x01
month
var byte _rtc_sec = 0x00
second
var byte _rtc_dayofweek
day of week
rtc_calibrate(sbyte in calibration)
Calibrate the RTCC module. input: calibration value output: none returns: nothing note: Calibration value is a signed byte (-128..+127). A negative value must be specified when the crystal is too fast. See datasheet for the calculation of the amount.
rtc_set_alarm_interval(byte in interval)
Set alarm interval. input: alarm_interval with a RTC_ALARM_INTERVAL_xxxx mask (see the defined RTC_ALARM_INTERVAL_xxxx masks above) output: none returns: nothing
rtc_set_alarm_dayofweek(byte in weekday)
Set alarm time. input: day-of-week of alarm (binary, 0..6) output: none returns: nothing Notes: When setting the alarm date the alarm interval is by default set to once a week on the specified day of the week. You may want to set the alarm time first, or control the alarm interval separately.
rtc_set_alarm(bit in state)
Enable or disable alarm. input: alarm_state (bit): true - enable alarm false - disable alarm output: none returns: nothing
rtc_set_alarm_repeat(byte in repeats)
Set alarm repetition. input: repeats: number of times to repeat alarm signal (binary) output: none returns: nothing notes: The following will happen after an alarm condition: - with repeat value 0 there will be 1 alarm event - with repeat values 1..254 there will be as many more alarm events as specified with(at intervals as specified with rtc_set_alarm_interval() ) - with repeat value 255 there will be indefinite alarm events The ALRMCFG_ALRMEN bit will be cleared after the last alarm event (thus never with repeat value 255).
rtc_pin_signal(bit*2 in pin_signal_selection_mask)
Select the RTCC output pin signal functionality. input: 2-bits mask: one of the RTC_PIN_xxxx constants (see above) output: none returns: nothing notes: - With 'NONE' pin_RTCC is released and available for I/O - See the datasheet for the meaning of the different masks.
rtc_set_clock(bit in state)
Enable or disable the RTCC module. input: none output: none returns: nothing notes: The T1 oscillator is enable/disabled too!
_rtc_read()
Read the realtime clock. input: none output: none returns: nothing notes: read clock/calendar registers into local variables
_rtc_write_control(bit in control)
Enable or disable RTCC register writes. input: bit (enable / disable) output: none returns: nothing notes: (Re)setting the RTCWREN bit in RTCCFG requires a strict sequence, see datasheets for details. JalV2 2.4n and 2.4o(beta) generate the correct sequences with the code below.
_rtc_write()
Write the realtime clock. input: none output: none returns: nothing notes: - enable writing to RTC registers - write clock/calendar registers - disable writes
_rtc_alrm_read()
Read the alarm setting. input: none output: none returns: nothing notes: read alarm registers into local variables
_rtc_alrm_write()
Write the alarm time of realtime clock. input: none output: none returns: nothing notes: - disable alarm - write alarm registers from local variables - restore alarm state
mult60(word in x) return dword
Multiply a word by 60 (typically for minutes to seconds or hours to minutes) input: byte with binary data output: none returns: word with product notes: - (x * 60) -> x * (64 - 4) -> (x * 64) - (x * 4) - algorithm without multiplication - word as input, dword as returnvalue chosen for relative second of day (function rtc_hhmmss_bin())
rtc_get_dayofweek() return byte
Get day of week. input: none output: none returns: day of the week (binary byte 0..6)
rtc_get_dayofyear() return word
Get day of year. input: none output: none returns: number of days sinece 1st of January (binary word 0..365)
rtc_get_minuteofday() return word
Get minute of day. input: none output: none returns: number of minutes since midnight (binary word)
bcd2bin(byte in bcd) return byte
====================================================================== General purpose functions / procedures ====================================================================== Convert one byte packed bcd to one byte binary. input: byte with bcd data output: none returns: byte with binary value of bcd byte notes: - A byte in bcd notation contains ((16 * tens) + ones). To convert it to a binary value: subtract (6 * tens) Algorithm is modeled after an assembler version of Scott Dattalo at PicList (but slightly less efficient!).
rtc_get_secondofday() return dword
Get second of day. input: none output: none returns: number of seconds since midnight (binary dword)
rtc_get_dayofmonth() return byte
Get day of month. input: none output: none returns: number of days since 1st of the month (binary byte 0..30)
18f26j11 | 18f26j11_rtcc_hw_kbd_lcd.jal |
18f27j53 | 18f27j53_rtcc_hw_alarm.jal |
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4n |
this library provides functions for SD memory cards.
SanDisk Secure Digital Card - http://www.cs.ucr.edu/~amitra/sdcard/ProdManualSDCardv1.9.pdf How to use MMC/SDC - http://forums.parallax.com/forums/attach.aspx?a=32012
SD card SPI mode is 1,1
const SD_CARD = 1
const byte SD_CLR_WRITE_PROT = 29
const byte SD_ERASE_WR_BLK_END = 33
const DATA_MEDIA = SD_CARD
const byte SD_READ_OCR = 58
const byte SD_STOP_TRANSMISSION = 12
const byte SD_WRITE_MULTIPLE_BLOCK = 25
var byte sd_word_count = 0
const byte SD_SEND_STATUS = 13
const byte SD_PROGRAM_CSD = 27
const word SD_BYTE_PER_SECTOR = 512
const byte SD_CRC_ON_OFF = 59
var word sd_sector_count = 0
const byte SD_SEND_NUM_WR_BLOCKS = 22
const byte SD_SET_CLR_CARD_DETECT = 42
const byte SD_WRITE_BLOCK = 24
const byte SD_SEND_OP_COND = 1
const byte SD_SET_BLOCKLEN = 16
const byte SD_SEND_CSD = 9
const byte SD_SD_APP_OP_COND = 41
const byte SD_SEND_SCR = 51
const byte SD_READ_MULTIPLE_BLOCK = 18
const PATA_HARD_DISK = 0
const byte SD_ERASE_WR_BLK_START = 32
const byte SD_READ_SINGLE_BLOCK = 17
var dword sd_sector_select
const byte SD_GEN_CMD = 56
const byte SD_SEND_CID = 10
const byte SD_APP_CMD = 55
const byte SD_SD_STATUS = 13
const byte SD_ERASE = 38
const byte SD_GO_IDLE_STATE = 0
const byte SD_SET_WR_BLK_ERASE_COUNT = 23
const byte SD_SEND_WRITE_PROT = 30
var word sd_byte_count = 0
const byte SD_SET_WRITE_PROT = 28
sd_read_sector_address(dword in address)
sd_stop_read()
sd_write_pulse(byte in count1)
sd_stop_write()
send_command(byte in command,dword in data, byte out response)
sd_sector_buffer'put(word in address, byte in data)
sd_set_idle()
sd_print_sector_hex(volatile byte out device,word in bytes_per_line,dword in address)
sd_write_sector_address(dword in address)
sd_ready()
sd_read_pulse_byte(word in count1)
sd_read_pulse(word in count1)
sd_start_write(dword in address)
sd_write_to_sector_end(byte in input_byte)
sd_init()
sd_print_sector(volatile byte out device, dword in address)
sd_write_pulse_byte(word in count1)
sd_write_sector()
sd_read_sector()
sd_start_read(dword in address)
sd_data_byte'put(byte in data_byte)
const SD_CARD = 1
No documentation found
const byte SD_CLR_WRITE_PROT = 29
No documentation found
const byte SD_ERASE_WR_BLK_END = 33
No documentation found
const DATA_MEDIA = SD_CARD
No documentation found
const byte SD_READ_OCR = 58
Other Commands
const byte SD_STOP_TRANSMISSION = 12
No documentation found
const byte SD_WRITE_MULTIPLE_BLOCK = 25
No documentation found
var byte sd_word_count = 0
counters
const byte SD_SEND_STATUS = 13
No documentation found
const byte SD_PROGRAM_CSD = 27
No documentation found
const word SD_BYTE_PER_SECTOR = 512
No documentation found
const byte SD_CRC_ON_OFF = 59
default is off
var word sd_sector_count = 0
No documentation found
const byte SD_SEND_NUM_WR_BLOCKS = 22
No documentation found
const byte SD_SET_CLR_CARD_DETECT = 42
No documentation found
const byte SD_WRITE_BLOCK = 24
Write Commands
const byte SD_SEND_OP_COND = 1
No documentation found
const byte SD_SET_BLOCKLEN = 16
Read Commands
const byte SD_SEND_CSD = 9
sd sends "Card Specific Data" standard or high capacity
const byte SD_SD_APP_OP_COND = 41
No documentation found
const byte SD_SEND_SCR = 51
No documentation found
const byte SD_READ_MULTIPLE_BLOCK = 18
No documentation found
const PATA_HARD_DISK = 0
constants for fat32 library
const byte SD_ERASE_WR_BLK_START = 32
Erase Commands
const byte SD_READ_SINGLE_BLOCK = 17
No documentation found
var dword sd_sector_select
No documentation found
const byte SD_GEN_CMD = 56
No documentation found
const byte SD_SEND_CID = 10
No documentation found
const byte SD_APP_CMD = 55
Application Specific Commands
const byte SD_SD_STATUS = 13
application specific command, must write command 55 first
const byte SD_ERASE = 38
No documentation found
const byte SD_GO_IDLE_STATE = 0
Basic Commands
const byte SD_SET_WR_BLK_ERASE_COUNT = 23
No documentation found
const byte SD_SEND_WRITE_PROT = 30
No documentation found
var word sd_byte_count = 0
No documentation found
const byte SD_SET_WRITE_PROT = 28
Write Protection Commands
sd_read_sector_address(dword in address)
No documentation found
sd_stop_read()
No documentation found
sd_write_pulse(byte in count1)
No documentation found
sd_stop_write()
No documentation found
send_command(byte in command,dword in data, byte out response)
No documentation found
sd_sector_buffer'put(word in address, byte in data)
No documentation found
sd_set_idle()
No documentation found
sd_print_sector_hex(volatile byte out device,word in bytes_per_line,dword in address)
print a sector to an output device in ascii hex
sd_write_sector_address(dword in address)
No documentation found
sd_ready()
No documentation found
sd_read_pulse_byte(word in count1)
No documentation found
sd_read_pulse(word in count1)
No documentation found
sd_start_write(dword in address)
No documentation found
sd_write_to_sector_end(byte in input_byte)
No documentation found
sd_init()
No documentation found
sd_print_sector(volatile byte out device, dword in address)
print a sector to an output device
sd_write_pulse_byte(word in count1)
No documentation found
sd_write_sector()
No documentation found
sd_read_sector()
No documentation found
sd_start_read(dword in address)
No documentation found
sd_data_byte'put(byte in data_byte)
No documentation found
_sd_read_512()
No documentation found
sd_sector_buffer'get(word in address) return byte
No documentation found
sd_data_byte'get() return byte
No documentation found
16f877 | 16f877_fat32_small_sd_card.jal |
16f877 | 16f877_sd_card.jal |
16f877a | 16f877a_sd_card.jal |
16f877a | 16f877a_fat32_small_sd_card.jal |
18f452 | 18f452_fat32_small_sd_card.jal |
18f452 | 18f452_sd_card.jal |
18f4525 | 18f4525_fat32_small_sd_card.jal |
18f4525 | 18f4525_sd_card.jal |
18f4525 | 18f4525_fat32_sd_card.jal |
18f4525 | 18f4525_mp3_decoder_vs1053b_sd_card.jal |
18f4550 | 18f4550_fat32_sd_card.jal |
18f4550 | 18f4550_fat32_small_sd_card.jal |
18f4550 | 18f4550_sd_card.jal |
18f4620 | 18f4620_mp3_decoder_vs1053b_sd_card.jal |
18f4620 | 18f4620_sd_card.jal |
18f4620 | 18f4620_fat32_sd_card.jal |
18f4620 | 18f4620_fat32_small_sd_card.jal |
18f67j50 | 18f67j50_sd_card.jal |
18f67j50 | 18f67j50_fat32_small_sd_card.jal |
18f67j50 | 18f67j50_mp3_decoder_vs1053b_sd_card.jal |
18f67j50 | 18f67j50_fat32_sd_card.jal |
Author | Stef Mientki, Copyright (c) 2002..2006, all rights reserved. |
Adapted-by | Sebastien Lelong. |
Compiler | >=2.4g |
USART hardware control. Routines for sending and receiving through the PIC-usart, both asynchrone and synchrone are supported. Baudrate can simply be set through a human constant, because the baudrate depending registers are calculated by this unit. Baudrate is calculated, starting at the high baudrate flag, which will ensure the highest possible accuracy.
serial_hw_data'put(byte in data)
serial_hw_init()
serial_hw_write_word(word in data)
serial_hw_write(byte in data)
serial_hw_data_raw'put(byte in data)
serial_hw_enable()
serial_hw_disable()
serial_hw_read(byte out data) return bit
serial_hw_data'get() return byte
serial_hw_data_raw'get() return byte
serial_hw_data'put(byte in data)
Here Serial read and write are definied as pseudo variables so you use them as normal vars, like * wait for character being received, * then echo the inverted character {{{ serial_hw_data = ! serial_hw_data }}} these procedures will wait till they can perform their action therefore it's better to use to following construct {{{ if charater received, echo the inverted character if serial_hw_data_available then serial_hw_data = ! serial_hw_data end if do other things }}}
serial_hw_init()
Initializes the serial port, calculates baudrate registers.
serial_hw_write_word(word in data)
like Serial_H_write, but then with a word as input The MSB is outputed first
serial_hw_write(byte in data)
serial_hw_write - write char to serial port, blocking Asynchronuous serial send routine, using the TX pin Sends byte X (8 bit with no parity) to the serial port First checks (and waits if necessary) if transmit buffer is empty
serial_hw_data_raw'put(byte in data)
These are real raw procedures, declared as pseudo variables the user is totally responsible for testing the transmit/receive flag before using these functions
serial_hw_enable()
Enables USART
serial_hw_disable()
Disables USART so ports can be used (temporary) for other purposes. USART can be enabled again by calling serial_hw_enable()
serial_hw_read(byte out data) return bit
serial_hw_read - read char if available (non-blocking) Returns true if a character was received, otherwise returns false. Overrun error flag is cleared.
serial_hw_data'get() return byte
No documentation found
serial_hw_data_raw'get() return byte
No documentation found
_serial_hw_read(byte out data) return bit
_serial_hw_read - internal use only! (using this inline function for serial_hw_data'get saves a stack level) Returns true if a character was received, otherwise returns false. Overrun error flag is cleared.
Author | Stef Mientki, Copyright (c) 2002..2006, all rights reserved. |
Adapted-by | Sebastien Lelong. |
Compiler | >=2.4g |
USART2 hardware control. Routines for sending and receiving through the EUSART2 (2nd EUSART module) both asynchrone and synchrone are supported. Baudrate can simply be set through a human constant, because the baudrate depending registers are calculated by this unit. Baudrate is calculated, starting at the high baudrate flag, which will ensure the highest possible accuracy.
serial_hw2_init()
serial_hw2_write(byte in data)
serial_hw2_enable()
serial_hw2_data_raw'put(byte in data)
serial_hw2_data'put(byte in data)
serial_hw2_write_word(word in data)
serial_hw2_disable()
serial_hw2_data_raw'get() return byte
serial_hw2_data'get() return byte
serial_hw2_read(byte out data) return bit
serial_hw2_init()
Initializes the serial port, calculates baudrate registers.
serial_hw2_write(byte in data)
Write char to serial port, blocking Asynchronuous serial send routine, using the TX pin Sends byte X (8 bit with no parity) to the serial port First checks (and waits if necessary) if transmit buffer is empty
serial_hw2_enable()
Enables USART
serial_hw2_data_raw'put(byte in data)
These are real raw procedures, declared as pseudo variables the user is totally responsible for testing the transmit/receive flag before using these functions
serial_hw2_data'put(byte in data)
Here Serial read and write are definied as pseudo variables so you use them as normal vars, like * wait for character being received, * then echo the inverted character {{{ serial_hw2_data = ! serial_hw2_data }}} these procedures will wait till they can perform their action therefore it's better to use to following construct {{{ if charater received, echo the inverted character if serial_hw2_data_available then serial_hw2_data = ! serial_hw2_data end if do other things }}}
serial_hw2_write_word(word in data)
like Serial_H_write, but then with a word as input The MSB is outputed first
serial_hw2_disable()
Disables USART so ports can be used (temporary) for other purposes. USART can be enabled again by calling serial_hw2_enable()
serial_hw2_data_raw'get() return byte
No documentation found
serial_hw2_data'get() return byte
No documentation found
serial_hw2_read(byte out data) return bit
Read char if available (non-blocking) Returns true if a character was received, otherwise returns false. Overrun error flag is cleared.
_serial_hw2_read(byte out data) return bit
Internal use only! (using this inline function for serial_hw2_data'get saves a stack level) Returns true if a character was received, otherwise returns false. Overrun error flag is cleared.
18f25k22 | 18f25k22_eusart2.jal |
18f27j53 | 18f27j53_pps_rx2tx2.jal |
Author | Rob Hamerling, Copyright (c) 2008..2009, all rights reserved. |
Adapted-by | Joep Suijs |
Compiler | =2.4h |
Serial communications: - receive and transmit data transfer is interrupt driven - receive and transmit data transfer uses circular buffers - automatic CTS flow control with spare free space for FiFo buffer
- For data transmit and receive the pins TX and RX are used automatically, these have not to be assigned by the application. - The selection of the CTS pin above is an example, any other pin which is configurable for output can be used. - When CTS flow control is not desired then assign serial_ctsinv to a dummy bit, for example: var bit dummy_cts_bit alias serial_ctsinv is dummy_cts_bit - The serial_overflow_discard flag may be dynamically changed (depending on how important the data is for the receiving party). - Do not touch the following interrupt bits: TXIE, RCIE, PEIE and GIE
var byte _serial_xmtbuf[SERIAL_XMTBUFSIZE]
var byte _serial_offsetrcvtail
var byte _serial_rcvbuf[SERIAL_RCVBUFSIZE]
var bit serial_send_success
var byte _serial_offsetrcvhead
var byte _serial_offsetxmttail
var byte _serial_offsetxmthead
serial_hw_read(byte out data) return bit
serial_hw_data'get() return byte
serial_receive_byte(byte out data) return bit
serial_send_byte(byte in data) return byte
var byte _serial_xmtbuf[SERIAL_XMTBUFSIZE]
Local circular transmit buffer
var byte _serial_offsetrcvtail
variable keeping track of next byte available to application program
var byte _serial_rcvbuf[SERIAL_RCVBUFSIZE]
Local circular receive buffer
var bit serial_send_success
Flag indicating if transmission was successful
var byte _serial_offsetrcvhead
variable keeping track of next free byte in receive buffer
var byte _serial_offsetxmttail
variable keeping track of next byte to be transmitted by interrupt handler
var byte _serial_offsetxmthead
variable keeping track of next free position in transmit buffer
serial_init()
Deprecated
serial_hw_data'put(byte in data)
Transmit byte
serial_hw_init()
serial_init - procedure to initialize library functionality
serial_hw_write(byte in data)
Transmit byte
_serial_transmit_interrupt_handler()
USART serial transmit interrupt handler
_serial_receive_interrupt_handler()
USART serial receive interrupt handler notes: - Sets CTS low when receive buffer has less thanbytes free space.
serial_hw_read(byte out data) return bit
Return byte (if any) from circular receive buffer for UART input: nothing output: received byte (if any) returns: TRUE when byte returned FALSE if no byte available notes: - Sets CTS high when receive buffer has more thanbytes free space after delivering byte to caller.
serial_hw_data'get() return byte
Return next received byte
serial_receive_byte(byte out data) return bit
Deprecated
serial_send_byte(byte in data) return byte
Put a single byte in circular transmit buffer for UART input: byte to transmit returns: transmitted byte (or 0x00 when data discarded) notes: - Activates transmit interrupt handler when data buffered - When buffer full act as indicated in 'serial_overflow_discard' * TRUE: discard data (and return 0x00 as data byte) * FALSE: wait for free buffer space (returns only after data has been stored in buffer)
16f1937 | 16f1937_serial_hardware.jal |
16f1937 | 16f1937_serial_hw_int_cts.jal |
16f648a | 16f648a_serial_hw_int_cts.jal |
16f723 | 16f723_serial_hw_int_cts.jal |
16f73 | 16f73_serial_hw_int_cts.jal |
16f877 | 16f877_serial_hw_int_cts.jal |
16f877a | 16f877a_serial_hw_int_cts.jal |
16f88 | 16f88_serial_hw_int_cts.jal |
16f88 | 16f88_serial_hw_int_cts_echo.jal |
18f14k50 | 18f14k50_serial_hw_int_cts.jal |
18f2450 | 18f2450_serial_hw_int_cts.jal |
18f2585 | 18f2585_canid4_serial_adapter.jal |
18f2585 | 18f2585_can_serial_adapter.jal |
18f4550 | 18f4550_serial_hw_int_cts.jal |
18f6310 | 18f6310_serial_hw_int_cts.jal |
18f6520 | 18f6520_serial_hw_int_cts.jal |
Author | Stef Mientki, Copyright (c) 2002..2006, all rights reserved. |
Adapted-by | Sebastien Lelong, Albert Faber, Joep Suijs (on behalf of Tijs van Roon) |
Compiler | >=2.4l |
software RS232 library Library supports software RS232 send and receive procedure on any IO-pin. Both the inverted and non-inverted routines are available, so it should fit any hardware. Baudrate can be set between 110 and 230_400 (for 20 Mhz Xtal), for lower Xtal frequencies the maximum baudrate will be equally lower. Baudrates are optimized, so even the high baudrates shouldn't be a problem (my [Stef] standard = 115_200 Baud, which has never given me any problems). Interrupts are disabled during transmissions. Transmission parameters are 8 databits, 2 stopbits, no parity, no handshake. const serial_sw_stopbits = 1 ; setup for one stopbit.
No dependency found
const serial_sw_bit_time = (1_000_000/serial_sw_baudrate) - ((13 * serial_sw_instruction_time) / 100)
const serial_sw_instruction_time = 400_000_000 / target_clock
serial_sw_data'put(byte in data)
serial_sw_write(byte in data)
serial_sw_init()
serial_sw_read_wait(byte out data)
const serial_sw_bit_time = (1_000_000/serial_sw_baudrate) - ((13 * serial_sw_instruction_time) / 100)
No documentation found
const serial_sw_instruction_time = 400_000_000 / target_clock
calculate instruction execution time in 10ns units
serial_sw_data'put(byte in data)
Here the serial_sw_write procedure is declared as a pseudo variable so you can use it in the following way: {{{ serial_sw_write = 0x33 }}}
serial_sw_write(byte in data)
Waits untill a character is received. Interrupts will be disabled during this routine, but restored afterwards. Also here the code is doubled (inverting and non-inverting) and selection is done by a compiler-directive.
serial_sw_init()
No documentation found
serial_sw_read_wait(byte out data)
Waits untill a character is received. Interrupts will be disabled during this routine, but restored afterwards. Also here the code is doubled (inverting and non-inverting) and selection is done by a compiler-directive.
serial_sw_data'get() return byte
Here the serial_sw_read_wait procedure is declared as a pseudo variable so you can use it in the following way {{{ Data = serial_sw_write }}}
serial_sw_read(byte out data) return bit
Waits untill a character is received or time out is reached. Interrupts will be disabled during this routine, but restored afterwards. Also here the code is doubled (inverting and non-inverting) and selection is done by a compiler-directive.
16f877a | 16f877a_serial_software.jal |
16f88 | 16f88_serial_sw_echo.jal |
18f4550 | 18f4550_fat32_sd_card.jal |
18f4550 | 18f4550_sd_card.jal |
18f4550 | 18f4550_serial_software.jal |
18f4550 | 18f4550_fat32_small_sd_card.jal |
18f4550 | 18f4550_23k256.jal |
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4m |
This library controls up to 24 servos that are the type used in radio control (RC). This is the main servo library.
http://www.horrorseek.com/home/halloween/wolfstone/Motors/svoint_RCServos.html
No dependency found
var bit servo_1_on at servo_1_to_8_on : 0
var bit servo_2_reverse at servo_reverse : 1
var bit servo_5_reverse at servo_reverse : 4
var bit servo_7_on at servo_1_to_8_on : 6
var bit servo_2_on at servo_1_to_8_on : 1
var bit servo_8_on at servo_1_to_8_on : 7
var bit servo_8_reverse at servo_reverse : 7
var bit servo_4_on at servo_1_to_8_on : 3
var byte _servo_1_to_8_number_count = 0
var bit servo_7_reverse at servo_reverse : 6
var bit _servo_1_to_8_isr_count = 0
var byte servo_1_to_8_on = 0xFF
var bit servo_6_reverse at servo_reverse : 5
var byte servo_reverse = 0x00
var bit servo_6_on at servo_1_to_8_on : 5
var bit servo_5_on at servo_1_to_8_on : 4
var bit servo_3_reverse at servo_reverse : 2
var bit servo_4_reverse at servo_reverse : 3
var bit servo_1_reverse at servo_reverse : 0
var bit servo_3_on at servo_1_to_8_on : 2
servo_move_percent(byte in percent, byte in servo_number)
servo_move(byte in location, byte in servo_number)
servo_init()
var bit servo_1_on at servo_1_to_8_on : 0
No documentation found
var bit servo_2_reverse at servo_reverse : 1
No documentation found
var bit servo_5_reverse at servo_reverse : 4
No documentation found
var bit servo_7_on at servo_1_to_8_on : 6
No documentation found
var bit servo_2_on at servo_1_to_8_on : 1
No documentation found
var bit servo_8_on at servo_1_to_8_on : 7
No documentation found
var bit servo_8_reverse at servo_reverse : 7
No documentation found
var bit servo_4_on at servo_1_to_8_on : 3
No documentation found
var byte _servo_1_to_8_number_count = 0
ISR servo control count 0 to 7
var bit servo_7_reverse at servo_reverse : 6
No documentation found
var bit _servo_1_to_8_isr_count = 0
ISR step count (0 - servo pulse / 1 - idle state)
var byte servo_1_to_8_on = 0xFF
use these variables to turn servo's on or off
var bit servo_6_reverse at servo_reverse : 5
No documentation found
var byte servo_reverse = 0x00
use these bit variables to reverse servo direction
var bit servo_6_on at servo_1_to_8_on : 5
No documentation found
var bit servo_5_on at servo_1_to_8_on : 4
No documentation found
var bit servo_3_reverse at servo_reverse : 2
No documentation found
var bit servo_4_reverse at servo_reverse : 3
No documentation found
var bit servo_1_reverse at servo_reverse : 0
No documentation found
var bit servo_3_on at servo_1_to_8_on : 2
No documentation found
servo_move_percent(byte in percent, byte in servo_number)
No documentation found
servo_move(byte in location, byte in servo_number)
No documentation found
servo_init()
No documentation found
_servo_1_to_8_set_level(byte in servo_1_to_8_num, bit in level)
No documentation found
_servo_isr()
No documentation found
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4m |
This library controls an external PIC that works as a slave device and is a dedicated PIC to servo movements.
http://www.horrorseek.com/home/halloween/wolfstone/Motors/svoint_RCServos.html
Also see servo_rc_master library, this is not the main servo library.
var bit _servo_rc_master_dedicated_error at _servo_rc_master_dedicated_data : 7
var bit _servo_rc_master_dedicated_ready4 at _servo_rc_master_dedicated_data : 0
const serial_hw_baudrate = 115200
var byte _servo_rc_master_dedicated_data
var bit _servo_rc_master_dedicated_ready3 at _servo_rc_master_dedicated_data : 2
var bit _servo_rc_master_dedicated_error2 at _servo_rc_master_dedicated_data : 5
const byte SERVO_RC_COMMAND_MOVE = 0
var bit _servo_rc_master_dedicated_ready2 at _servo_rc_master_dedicated_data : 4
const byte SERVO_RC_COMMAND_MIN = 96
const byte SERVO_RC_COMMAND_REVERSE = 32
var bit _servo_rc_master_dedicated_error4 at _servo_rc_master_dedicated_data : 1
const byte SERVO_RC_COMMAND_MAX = 128
const byte SERVO_RC_COMMAND_ON_OFF = 64
var bit _servo_rc_master_dedicated_ready at _servo_rc_master_dedicated_data : 6
var bit _servo_rc_master_dedicated_error3 at _servo_rc_master_dedicated_data : 3
servo_rc_error_i2c(byte in servo_ic_address) return bit
servo_rc_is_ready_i2c(byte in servo_ic_address) return bit
var bit _servo_rc_master_dedicated_error at _servo_rc_master_dedicated_data : 7
No documentation found
var bit _servo_rc_master_dedicated_ready4 at _servo_rc_master_dedicated_data : 0
No documentation found
const serial_hw_baudrate = 115200
setup uart for communication
var byte _servo_rc_master_dedicated_data
holds error & ready bit recieved from slave, internal use only
var bit _servo_rc_master_dedicated_ready3 at _servo_rc_master_dedicated_data : 2
No documentation found
var bit _servo_rc_master_dedicated_error2 at _servo_rc_master_dedicated_data : 5
No documentation found
const byte SERVO_RC_COMMAND_MOVE = 0
servo commands that you may pass to the send_command procedure
var bit _servo_rc_master_dedicated_ready2 at _servo_rc_master_dedicated_data : 4
No documentation found
const byte SERVO_RC_COMMAND_MIN = 96
set servo min movement
const byte SERVO_RC_COMMAND_REVERSE = 32
reverse servo command
var bit _servo_rc_master_dedicated_error4 at _servo_rc_master_dedicated_data : 1
No documentation found
const byte SERVO_RC_COMMAND_MAX = 128
set servo max movement
const byte SERVO_RC_COMMAND_ON_OFF = 64
turn servo on/off
var bit _servo_rc_master_dedicated_ready at _servo_rc_master_dedicated_data : 6
No documentation found
var bit _servo_rc_master_dedicated_error3 at _servo_rc_master_dedicated_data : 3
No documentation found
servo_rc_send_command_i2c(byte in servo_ic_address, byte in command, byte in command_data, byte in servo_num)
No documentation found
servo_rc_error_i2c(byte in servo_ic_address) return bit
No documentation found
servo_rc_is_ready_i2c(byte in servo_ic_address) return bit
No documentation found
16f877a | 16f877a_servo_rc_master_dedicated_master_i2c.jal |
18f452 | 18f452_servo_rc_master_dedicated_master_i2c.jal |
18f4620 | 18f4620_servo_rc_master_dedicated_master_i2c.jal |
Author | Wouter van Ooijen (c) 1998, all rights reserved. |
Adapted-by | Joep Suijs, Vasile Surducan 25.08.2009 |
Compiler | >=2.2 |
Translation routine for 7 segment display. The seven segment display needs to be connected to a single port. Define the pin layout of the seven segment display like: constant for the segments gfe dcba const byte seven_segment_a = 0b_0000_0001 const byte seven_segment_b = 0b_0000_0010 const byte seven_segment_c = 0b_0000_0100 const byte seven_segment_d = 0b_0000_1000 const byte seven_segment_e = 0b_0001_0000 const byte seven_segment_f = 0b_0010_0000 const byte seven_segment_g = 0b_0100_0000 const byte seven_segment_dp = 0b_1000_0000 character set: value 0 is character 0 value 1 is character 1 value 2 is character 2 value 3 is character 3 value 4 is character 4 value 5 is character 5 value 6 is character 6 value 7 is character 7 value 8 is character 8 value 9 is character 9 value 10 is character A value 11 is character b value 12 is character C_big value 13 is character d value 14 is character E value 15 is character F value 16 is character S value 17 is character c_small value 18 is character r value 19 is character H value 20 is character i_small value 21 is character L value 22 is character o value 23 is character P value 24 is character U_big value 26 is character u value 27 is character space Use: const bit seven_segment_common_anode = true ; omit this line if you use a common cathode display. portd_direction = all_output portd = seven_from_digit(1) -- display '1'
No dependency found
const byte seven_value_space[] = {
No documentation found
seven_from_digit( byte in x ) return byte
return seven segment value corresponding to lower nibble of x
16f877 | 16f877_seven_segment.jal |
16f877a | 16f877a_seven_segment.jal |
18f4550 | 18f4550_seven_segment.jal |
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4n |
This library sends and receives SLIP (Serial Line IP) packets for communication with serial data in packet form.
http://tools.ietf.org/html/rfc1055
No dependency found
var byte _slip_tx_packet_data_count = 0
var byte _slip_last_char
const byte _SLIP_ESC_ESC = 0xDD
var byte _slip_rx_packet_finished = FALSE
var byte _slip_rx_packet_data_count = 0
const byte _SLIP_ESC = 0xDB
const byte _SLIP_ESC_END = 0xDC
const byte _SLIP_END = 0xC0
var byte _slip_tx_packet_data_count = 0
No documentation found
var byte _slip_last_char
No documentation found
const byte _SLIP_ESC_ESC = 0xDD
221
var byte _slip_rx_packet_finished = FALSE
some global vars
var byte _slip_rx_packet_data_count = 0
No documentation found
const byte _SLIP_ESC = 0xDB
219
const byte _SLIP_ESC_END = 0xDC
220
const byte _SLIP_END = 0xC0
SLIP special character codes
slip_send_data(byte in data)
No documentation found
slip_end_packet()
No documentation found
slip_poll()
No documentation found
slip_init()
No documentation found
Author | Vasile Surducan, Copyright (c) 2010...2012, all rights reserved. |
Adapted-by | |
Compiler | >=2.4m |
software implementation for single SMbus master, use 4 hw stack
const id_number1 = 0x0F ; read only
var word temp = 0
var byte mem_low = 0
var volatile bit pwm_frequency at config: 1 ; 1=low, 0=high
var word config
const raw_ir_data = 0x05
var word temperature_k = 0
const tambiant = 0x06
const emissivity = 0x03
var volatile bit*3 iir_setting at config: 12 ; see table below
var word w_t_high = 0
var sword temperature_c = 0
var byte mem_high = 0
var byte t_high = 0
var volatile bit zero at config: 15 ; keep 0
const config_reg = 0x02
const bit ACK = low
const pwm_t_range = 0x01
const bit NACK = high
const tobject = 0x07
var sword temperature = 0
const id_number0 = 0x0E ; read only
const eeprom_access = 0b0001_0000
var volatile bit*9 factory_cal at config: 3 ; do not alter
const sleep_mode = 0b1100_0110
const smbus_sa = 0 ; SMbus Slave Address 7 bit, 0 to 6; 0x5b factory default
var sword s_t_high = 0
var bit mlx90615_ack = high
const ram_access = 0b0010_0000
var byte pec = 0
var volatile bit mode_select at config: 0 ; 1=SMbus, 0=PWM
var volatile bit pwm_output_temp at config: 2 ; 1=Tambiant, 0=Tobject
const sword c27315 = 27315
var byte nack_counter = 0
mlx90615_sleep( byte in senzor_address )
calculate_temp_k()
mlx90615_wake()
calculate_temp_c()
sm_start_bit()
sm_stop_bit()
sm_bus_initialize() is ; not necesary if SMbus
const id_number1 = 0x0F ; read only
No documentation found
var word temp = 0
No documentation found
var byte mem_low = 0
No documentation found
var volatile bit pwm_frequency at config: 1 ; 1=low, 0=high
No documentation found
var word config
No documentation found
const raw_ir_data = 0x05
0x04 to 0x4h Melexis reserved
var word temperature_k = 0
No documentation found
const tambiant = 0x06
No documentation found
const emissivity = 0x03
No documentation found
var volatile bit*3 iir_setting at config: 12 ; see table below
No documentation found
var word w_t_high = 0
No documentation found
var sword temperature_c = 0
No documentation found
var byte mem_high = 0
No documentation found
var byte t_high = 0
var byte t_low = 0
var volatile bit zero at config: 15 ; keep 0
No documentation found
const config_reg = 0x02
No documentation found
const bit ACK = low
No documentation found
const pwm_t_range = 0x01
No documentation found
const bit NACK = high
No documentation found
const tobject = 0x07
No documentation found
var sword temperature = 0
No documentation found
const id_number0 = 0x0E ; read only
No documentation found
const eeprom_access = 0b0001_0000
No documentation found
var volatile bit*9 factory_cal at config: 3 ; do not alter
No documentation found
const sleep_mode = 0b1100_0110
No documentation found
const smbus_sa = 0 ; SMbus Slave Address 7 bit, 0 to 6; 0x5b factory default
No documentation found
var sword s_t_high = 0
No documentation found
var bit mlx90615_ack = high
No documentation found
const ram_access = 0b0010_0000
No documentation found
var byte pec = 0
No documentation found
var volatile bit mode_select at config: 0 ; 1=SMbus, 0=PWM
No documentation found
var volatile bit pwm_output_temp at config: 2 ; 1=Tambiant, 0=Tobject
No documentation found
const sword c27315 = 27315
No documentation found
var byte nack_counter = 0
No documentation found
mlx90615_sleep( byte in senzor_address )
No documentation found
calculate_temp_k()
conversion to kelvin
mlx90615_wake()
No documentation found
calculate_temp_c()
No documentation found
sm_start_bit()
SMbus start bit
sm_stop_bit()
SMbus stop bit
sm_bus_initialize() is ; not necesary if SMbus
No documentation found
_scl_high()
No documentation found
_sda_high()
No documentation found
_scl_low()
No documentation found
_sm_send_bit(bit in x)
Transmit one bit on SM bus (for internal use only )
_sda_low()
No documentation found
_sm_receive_bit(bit out x)
Receive one bit on SM bus (for internal use only)
sm_transmit_byte(byte in tx_buffer) return bit
Transmit one byte on SM bus
sm_receive_byte(bit in ack_noack) return byte
Receive one byte on SM bus
18f25j10 | 18f25j10_test_mlx90615.jal |
Author | Sebastien Lelong(c) 2011, all rights reserved. |
Adapted-by | |
Compiler | 2.4n |
SPI Master common constant definition, used both by MSSP1 and MSSP2
content was extracted from spi_master_hw.jal at rev 1537 http://code.google.com/p/jallib/source/browse/trunk/include/peripheral/spi/spi_master_hw.jal?r=1537
No dependency found
const SPI_RATE_FOSC_64 = 2
const SPI_MODE_01 = 1
const SPI_MODE_11 = 3
const SPI_RATE_FOSC_4 = 0
const SPI_RATE_TMR = 3
const SPI_RATE_FOSC_16 = 1
const SPI_MODE_00 = 0
const SPI_MODE_10 = 2
const SPI_RATE_FOSC_64 = 2
No documentation found
const SPI_MODE_01 = 1
No documentation found
const SPI_MODE_11 = 3
No documentation found
const SPI_RATE_FOSC_4 = 0
Use these when calling the spi_init() routine below ( SPI clock frequency )
const SPI_RATE_TMR = 3
No documentation found
const SPI_RATE_FOSC_16 = 1
No documentation found
const SPI_MODE_00 = 0
Use these when calling the spi_init() routine below ( SPI master mode )
const SPI_MODE_10 = 2
No documentation found
Author | William Welch Copyright (c) 2009, all rights reserved. |
Adapted-by | Sebastien Lelong |
Compiler | 2.4l |
SPI Master hardware control. Routines for sending and receiving through the SPI in master mode
good overview of SPI at http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus also at: http://elm-chan.org/docs/spi_e.html
spi_master_hw_set_speed(byte in spi_rate)
spi_master_hw_set_mode_10()
spi_master_hw_set_mode_01()
spi_master_hw_set_mode_11()
spi_init(byte in spi_mode, byte in spi_rate)
spi_master_hw'put(byte in data)
spi_master_hw_set_mode_00()
spi_master_hw_set_mode(byte in spi_mode)
spi_master_hw_set_speed(byte in spi_rate)
No documentation found
spi_master_hw_set_mode_10()
No documentation found
spi_master_hw_set_mode_01()
No documentation found
spi_master_hw_set_mode_11()
No documentation found
spi_init(byte in spi_mode, byte in spi_rate)
Initialize the SPI registers. Note: check your datasheet -- TRIS settings, any SPI errata?
spi_master_hw'put(byte in data)
half-duplex convenience function. send data to slave, discard reply
spi_master_hw_set_mode_00()
No documentation found
spi_master_hw_set_mode(byte in spi_mode)
Specify SPI mode (see spi_common for predefined constant you can use as parameters)
spi_master_hw_exchange(byte in m_data) return byte
SPI is full-duplex, so we exchange master and slave data byte
spi_master_hw'get() return byte
half-duplex convenience function. send 0xFF, get slave data
Author | Sebastien Lelong Copyright (c) 2011, all rights reserved. |
Adapted-by | |
Compiler | 2.4n |
SPI Master hardware control. Routines for sending and receiving through the SPI in master mode, using MSSP2
good overview of SPI at http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus also at: http://elm-chan.org/docs/spi_e.html
this is a rough duplication of spi_master_hw.jal at rev 1537, (http://code.google.com/p/jallib/source/browse/trunk/include/peripheral/spi/spi_master_hw.jal?r=1537) originally written by William Welch, from which MSSP1 registers were modified to match MSSP2 names.
spi_master_hw2'put(byte in data)
spi_master_hw2_set_speed(byte in spi_rate)
spi_master_hw2_set_mode_10()
spi_master_hw2_set_mode_11()
spi2_init(byte in spi_mode, byte in spi_rate)
spi_master_hw2_set_mode_01()
spi_master_hw2_set_mode_00()
spi_master_hw2_set_mode(byte in spi_mode)
spi_master_hw2'put(byte in data)
half-duplex convenience function. send data to slave, discard reply
spi_master_hw2_set_speed(byte in spi_rate)
No documentation found
spi_master_hw2_set_mode_10()
No documentation found
spi_master_hw2_set_mode_11()
No documentation found
spi2_init(byte in spi_mode, byte in spi_rate)
Initialize the SPI registers. Note: check your datasheet -- TRIS settings, any SPI errata?
spi_master_hw2_set_mode_01()
No documentation found
spi_master_hw2_set_mode_00()
No documentation found
spi_master_hw2_set_mode(byte in spi_mode)
Specify SPI mode (see spi_common for predefined constant you can use as parameters)
spi_master_hw2'get() return byte
half-duplex convenience function. send 0xFF, get slave data
spi_master_hw2_exchange(byte in m_data) return byte
SPI is full-duplex, so we exchange master and slave data byte
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | Sebastien Lelong |
Compiler | >=2.4l |
This is library for 23K256 SPI SRAM, Microchip's 20mhz 256kbit SRAM memory
http://ww1.microchip.com/downloads/en/DeviceDoc/22100D.pdf
Address from 0 to 32,767 This is a 2.7v to 3.6v memory. This lib should also work with 23k640 (64kbit sram), but hasn't been tested, please let me know. Also should work with 23A640 & 23A256 (1.5v to 1.95v versions), also not tested SPI Mode is 00 for 23k256
No dependency found
const byte SRAM_23K256_PAGE_MODE = 0b10
const byte SRAM_23K256_WRITE_SETTINGS = 0b_0000_0001
const byte SRAM_23K256_HOLD_DISABLE = 1
const byte SRAM_23K256_BYTE_MODE = 0b00
const byte SRAM_23K256_READ_COMMAND = 0b_0000_0011
const byte SRAM_23K256_HOLD_ENABLE = 0
const byte SRAM_23K256_WRITE_COMMAND = 0b_0000_0010
const byte SRAM_23K256_SEQUENTIAL_MODE = 0b01
const byte SRAM_23K256_READ_STATUS = 0b_0000_0101
sram_23k256_start_write(word in address)
sram_23k256_init(byte in sram_23k256_mode, byte in sram_23k256_hold_disable)
sram_23k256_byte'put(word in address, byte in data)
sram_23k256_do_read(byte out data)
sram_23k256_dword'put(word in address, dword in data)
sram_23k256_read_settings(byte out mode, byte out hold_is_disabled)
sram_23k256_do_write(byte in data)
sram_23k256_word'put(word in address, word in data)
sram_23k256_write(word in address, byte in data)
sram_23k256_read(word in address, byte out data)
sram_23k256_stop_read()
sram_23k256_start_read(word in address)
sram_23k256_stop_write()
sram_23k256_dword'get(word in address) return dword
sram_23k256_word'get(word in address) return word
sram_23k256_byte'get(word in address) return byte
const byte SRAM_23K256_PAGE_MODE = 0b10
send read command then read 1 32Byte page
const byte SRAM_23K256_WRITE_SETTINGS = 0b_0000_0001
Write STATUS register
const byte SRAM_23K256_HOLD_DISABLE = 1
disable the hold pin. (connect put pin direct to 3.3v)
const byte SRAM_23K256_BYTE_MODE = 0b00
constants for use with init procedure input data modes in witch to read and write data
const byte SRAM_23K256_READ_COMMAND = 0b_0000_0011
constants for internal usage
const byte SRAM_23K256_HOLD_ENABLE = 0
enable the hold pin (conect pin to microcontroller)
const byte SRAM_23K256_WRITE_COMMAND = 0b_0000_0010
Write data to memory array beginning at selected address
const byte SRAM_23K256_SEQUENTIAL_MODE = 0b01
send read command then read many bytes
const byte SRAM_23K256_READ_STATUS = 0b_0000_0101
Read STATUS register
sram_23k256_start_write(word in address)
get 23K256 ready for writing and select a address to start from (fast writes) do not interupt read process by switching to another spi device
sram_23k256_init(byte in sram_23k256_mode, byte in sram_23k256_hold_disable)
initialize startup settings & spi mode 00
sram_23k256_byte'put(word in address, byte in data)
Write to 23k256 as a byte array
sram_23k256_do_read(byte out data)
read byte from the 23K256
sram_23k256_dword'put(word in address, dword in data)
Write 23k256 as a large 8K dword array
sram_23k256_read_settings(byte out mode, byte out hold_is_disabled)
Reads the status/settings register to get the current 23k256 mode that was previously set in the init procedure. SRAM_23K256_BYTE_MODE, SRAM_23K256_SEQUENTIAL_MODE, SRAM_23K256_PAGE_MODE
sram_23k256_do_write(byte in data)
write byte to the 23K256 you may use spi_master directly instead.
sram_23k256_word'put(word in address, word in data)
Write 23k256 as a large 16K word array
sram_23k256_write(word in address, byte in data)
Write 1 byte to selected address
sram_23k256_read(word in address, byte out data)
Read 1 byte to selected address
sram_23k256_stop_read()
tell 23K256 you are finished reading
sram_23k256_start_read(word in address)
get 23K256 ready for reading and select a address to start from (fast reads) do not interupt read process by switching to another spi device
sram_23k256_stop_write()
tell 23K256 you are finished writing
sram_23k256_dword'get(word in address) return dword
Read from 23k256 as a large 8K dword array
sram_23k256_word'get(word in address) return word
Read from 23k256 as a large 16K word array
sram_23k256_byte'get(word in address) return byte
Read from 23k256 as a byte array
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4n |
Creates a stopwatch for timing events
You do not need to define any constants in your program. Stopwatch will choose these default values for you.
No dependency found
var byte*4 stopwatch_high_value at _stopwatch_counter : 16
var byte stopwatch_counter[_stopwatch_count_size] at _stopwatch_counter
var word _stopwatch_step_time
const _stopwatch_count_size = 6
var byte*_stopwatch_count_size _stopwatch_counter
stopwatch_cycles'get() return byte*STOPWATCH_VAR_SIZE
stopwatch_read_cycles() return byte*STOPWATCH_VAR_SIZE
stopwatch_read_time() return byte*STOPWATCH_VAR_SIZE
stopwatch_time_overflow'get() return bit
stopwatch'get() return byte*STOPWATCH_VAR_SIZE
stopwatch_cycle_overflow'get() return bit
var byte*4 stopwatch_high_value at _stopwatch_counter : 16
No documentation found
var byte stopwatch_counter[_stopwatch_count_size] at _stopwatch_counter
No documentation found
var word _stopwatch_step_time
time of one timer step
const _stopwatch_count_size = 6
size of stopwatch counter
var byte*_stopwatch_count_size _stopwatch_counter
define the stopwatch counter
stopwatch_isr()
No documentation found
stopwatch_start()
No documentation found
stopwatch_continue()
No documentation found
stopwatch_init()
No documentation found
stopwatch_stop()
No documentation found
stopwatch_cycles'get() return byte*STOPWATCH_VAR_SIZE
No documentation found
stopwatch_read_cycles() return byte*STOPWATCH_VAR_SIZE
No documentation found
stopwatch_read_time() return byte*STOPWATCH_VAR_SIZE
No documentation found
stopwatch_time_overflow'get() return bit
No documentation found
stopwatch'get() return byte*STOPWATCH_VAR_SIZE
No documentation found
stopwatch_cycle_overflow'get() return bit
No documentation found
16f877 | 16f877_stopwatch.jal |
16f877a | 16f877a_stopwatch.jal |
18f452 | 18f452_stopwatch.jal |
18f4525 | 18f4525_stopwatch.jal |
18f4550 | 18f4550_stopwatch.jal |
18f4620 | 18f4620_stopwatch.jal |
18f67j50 | 18f67j50_stopwatch.jal |
Author | Eur van Andel, eur@fiwihex.nl Copyright (c) 2008 |
Adapted-by | |
Compiler | =2.4h |
The Sensirion SHT1x/SHT7x is a single chip relative humidity and temperature multi sensor module comprising a calibrated digital output. It comes in 5 flavors, with different accuracy and package style: sensor hum acc temp acc package SHT10 4.5% 0.5C SMD (LCC) SHT11 3.0% 0.4C SMD (LCC) SHT15 2.0% 0.3C SMD (LCC) SHT71 3.0% 0.4C 4-pin single-in-line SHT75 1.8% 0.3C 4-pin single-in-line all consist of the same silicon: the less accurate models are sold cheaper. My experience is mixed: I've seen some consistent +2C offset in temperature, but good humidty measurements. The 4-pin package breaks when you touch it. The SMD package has naked tracks underneath: you can't route under it! If exposed to >95% RH for 10 minutes, these sensors will go beserk and need <60% RH for an hour to recover. You might try heating them. protocol is close to I2C, but not the same. Remember to pull up DATA. 0b0000_0011 starts temperature measurement 0b0000_0101 starts humidity measurement device returns three bytes: MSB, LSB and CRC this library doesn't perform any CRC check
http://www.sensirion.com/en/01_humidity_sensors/00_humidity_sensors.htm
read_raw_hum_sht(byte out MSB, byte out LSB, byte out CRC)
read_hum_word_sht(word out hum)
sht_get_data(byte out x)
sht_start()
sht_put_ack()
sht_wait_ack_out(bit out ack)
sht_conn_reset()
sht_wait_ack()
sht_reset()
read_centicelsius_temp_sht(sword out centicelsius)
sht_put_data(byte in x)
read_celsius_temp_sht(sbyte out celsius)
read_hum_sht(byte out hum)
read_raw_temp_sht(byte out MSB, byte out LSB, byte out CRC)
read_raw_hum_sht(byte out MSB, byte out LSB, byte out CRC)
read raw 12-bit humidity from SHT default value of resolution bit is 12 bit RH SHT takes 55 ms for measurement @ 12 bits we will wait 70 ms SHT may only be switched on for 10% of the time because of self-heating so this measurement can only happen every 500ms
read_hum_word_sht(word out hum)
read humidity from SHT, result in word precision 0.01%RH SHT may only be switched on for 10% of the time because of self-heating so this measurement can only happen every 500ms
sht_get_data(byte out x)
receive one byte from the SHT
sht_start()
send start _____ ________ DATA: |_______| ___ ___ SCK : ___| |___| |______
sht_put_ack()
send ACK
sht_wait_ack_out(bit out ack)
No documentation found
sht_conn_reset()
reset SHT interface, must be followed with sht_start and command
sht_wait_ack()
wait for ACK, but continue after 1 ms
sht_reset()
reset SHT
read_centicelsius_temp_sht(sword out centicelsius)
read Celcius temperature from SHT with 0.01 C resolution, result is sword type, so -327.68 .. +327.68 C SHT takes 320 ms for measurement @ 14 bits we will wait 400 ms SHT may only be switched on for 10% of the time because of self-heating so this measurement can only happen every four seconds!
sht_put_data(byte in x)
send one byte to the SHT
read_celsius_temp_sht(sbyte out celsius)
read Celcius temperature from SHT with 1 C resolution, result is sbyte type, so -126...+127C SHT takes 320 ms for measurement @ 14 bits we will wait 400 ms SHT may only be switched on for 10% of the time because of self-heating so this measurement can only happen every four seconds!
read_hum_sht(byte out hum)
read humidity from SHT, result in byte precision 1%RH SHT may only be switched on for 10% of the time because of self-heating so this measurement can only happen every 500ms
read_raw_temp_sht(byte out MSB, byte out LSB, byte out CRC)
read raw 14-bit temperature from SHT default value of resolution bit is 14 bit temperature SHT takes 320 ms for measurement @ 14 bits we will wait 330 ms SHT may only be switched on for 10% of the time because of self-heating so this measurement can only happen every two seconds!
Author | Eur van Andel, eur@fiwihex.nl Copyright (c) 2010 |
Adapted-by | |
Compiler | =2.4h |
this library reads the TC77 temperature sensor from Microchip. The TC77 has a 12-bit plus sign temperature resolution of 0.0625°C per Least Significant Bit (LSb). It works via the SPI protocol Specs: 1C (max.) accuracy from +25°C to +65C, 2C (max.) accuracy from -40°C to +85C 3C (max.) accuracy from -55°C to +125C 2.7V to 5.5V Operating Range, Low Power: 250uA (typ.) Continuous Conversion Mode, 0.1uA (typ.) Shutdown Mode -------- I have several years of experience with hundreds of these sensors. They work very well: fast, good accuracy, good repeatability. If they have an offset, it can easily be calibrated in software. The hard part of using this sensor is gettting it watertigtht. It is SMD, so it needs a PCB, and a cable. Dipping in resin or shrinking in glue-covered shrinktube works. The SPI protocol is bit-banged here and can be used with any pins. Clock data in on rising edge of clock, program must pull CS low. This allows for multiple TC77s on the same 2-wire databus. Put a 100nF decoupling capacitor close the the TC77. If you don't, you WILL get weird data. Writing the status_word is not supported here.
This library expects two pins defined as SIO and SCK: var bit SCK is pin_xx = high -- TC77 common clock pin_xx_direction = output var bit SIO is pin_yy -- TC77 common data pin_yy_direction = input include temperature_tc77 -- this library A third pin is needed for /CS: var bit cs is pin_zz = high -- chipselect TC77 sensor pin_zz_direction = output Usage is: CS = low tc77_read_celsius_sword(T1) CS = high Multiple TC77s can share the same bus, but each needs its own /CS pin.
tc77_read_celsius_sdword(sdword out temperature)
tc77_read_raw(word out raw)
tc77_read_celsius_sword(sword out temperature)
tc77_read_celsius_sbyte(sbyte out temperature)
tc77_read_celsius_sdword(sdword out temperature)
read celsius temperature of TC77 output in one sdword with 4 digits, so T = xxx.xxxx C last bit is 0.0001C , range is -40C ... +125C
tc77_read_raw(word out raw)
get raw temperature of TC77 output in word, right justified
tc77_read_celsius_sword(sword out temperature)
read celsius temperature of TC77 output in one sword with 2 digits, so T = xxx.xx C last bit is 0.01C , range is -40C ... +125C best procedure if you want to display C in 0.1 accurate take care of rounding during printing
tc77_read_celsius_sbyte(sbyte out temperature)
read celsius temperature of TC77 output in one sbyte with zero digits, so T = +/- xxx C last bit is 1C, range is -40C ... +125C no rounding, celsius fraction is chopped
12hv615 | 12hv615_temperature_fan.jal |
16f876a | 16f876a_tc77.jal |
Author | Joep Suijs, Copyright (C) 2008 Joep Suijs |
Adapted-by | Rob Hamerling |
Compiler | >=2.4j |
Fixed interval isr with support for non-blocking delays.
No dependency found
var word internal_isr_counter
No documentation found
var word isr_countdown[DELAY_SLOTS]
No documentation found
var byte timer0_load
No documentation found
timer0_isr_init()
No documentation found
set_delay(byte in slot, word in ticks)
No documentation found
ISR()
No documentation found
isr_counter'get() return word
No documentation found
check_delay(byte in slot) return bit
No documentation found
16f648a | 16f648a_timer0_interval.jal |
16f723 | 16f723_timer0_interval.jal |
16f73 | 16f73_timer0_interval.jal |
16f877 | 16f877_timer0_interval.jal |
16f877a | 16f877a_timer0_interval.jal |
16f88 | 16f88_timer0_interval.jal |
18f14k50 | 18f14k50_timer0_interval.jal |
18f2450 | 18f2450_timer0_interval.jal |
18f4550 | 18f4550_timer0_interval.jal |
Author | Joep Suijs, Copyright (C) 2008 Joep Suijs |
Adapted-by | Rob Hamerling, William Welch |
Compiler | >=2.4m |
Fixed interval support for non-blocking delays, but without using an interrupt.
No dependency found
var word timer0_interval_counter
No documentation found
var word timer0_countdown[DELAY_SLOTS]
No documentation found
var word timer0_load
preload value for timer0
timer0_poll_init()
initialize the timer and related variables. automatically detects and makes use of 16-bit timer0 if present.
set_delay(byte in slot, word in ticks)
setup the delay for the specified slot.
_timer0_poll()
for internal use only. roughly equivalent to timer0 ISR
_timer0_poll_init_rate(dword in overflow_rate)
for internal use only
check_delay(byte in slot) return bit
returns "true" when the delay has been achieved. be sure to call this routine fairly often if you care about fairly accurate delays.
interval_counter'get() return word
returns the current value of the interval timer
18f14k50 | 18f14k50_tmr0_poll_interval.jal |
18f2450 | 18f2450_tmr0_poll_interval.jal |
18f4550 | 18f4550_tmr0_poll_interval.jal |
18f4585 | 18f4585_canopen_blink.jal |
18f4585 | 18f4585_tmr0_poll_interval.jal |
Author | Sebastien Lelong, Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4k |
set of procedures used to perform unittest
No dependency found
var volatile word _ut_trash_word
var volatile bit _ut_trash_bit
var volatile dword _ut_trash_dword
var volatile byte _ut_trash_byte
var volatile sword _ut_trash_sword
var volatile sdword _ut_trash_sdword
test_dword(dword in t)
test_byte(byte in t)
test_sdword(sdword in t)
test_word(word in t)
test_sword(sword in t)
test_bit(bit in t)
var volatile word _ut_trash_word
No documentation found
var volatile bit _ut_trash_bit
No documentation found
var volatile dword _ut_trash_dword
No documentation found
var volatile byte _ut_trash_byte
No documentation found
var volatile sword _ut_trash_sword
No documentation found
var volatile sdword _ut_trash_sdword
No documentation found
test_dword(dword in t)
No documentation found
test_byte(byte in t)
No documentation found
test_sdword(sdword in t)
No documentation found
test_word(word in t)
No documentation found
test_sword(sword in t)
No documentation found
test_bit(bit in t)
No documentation found
Author | Stef Mientki Copyright (c) 2002..2010, all rights reserved. |
Adapted-by | Sebastien Lelong, Joep Suijs, Rob Hamerling |
Compiler | >=2.4n |
USART2 common functions This file provides common functions to other libraries. Baudrate can simply be set through a constant in the application program, because the baudrate depending registers are calculated by this unit. Baudrate is calculated, starting at the high baudrate flag, which will ensure the highest possible accuracy.
No dependency found
_calculate_and_set_baudrate2()
internal function, calculates and sets baudrate divider and stores it in the appropiate register. the high-speed / low-speed bit is not stored but returned as the result Special attention is payed to the highest and lowest baudrates, a deviation of 5% is accepted in these cases Asynchronous baudrate settings {{{ for ESUART (with 16 bits baudrate generator) SPBRGH2/SPBRG2 = ( Fosc / ( 4 * Baudrate ) ) -1 if TXSTA2_BRGH = 1 (high speed) SPBRG2 = ( Fosc / ( 16 * Baudrate ) ) -1 if TXSTA2_BRGH = 0 (low speed) SPBRG2 = ( Fosc / ( 64 * Baudrate ) ) -1 }}} Synchronous baudrate settings: * TXSTA2_BRGH = 0 (low speed) * SPBRG2 = ( Fosc / ( 4 * Baudrate ) ) -1
Author | Stef Mientki Copyright (c) 2002..2010, all rights reserved. |
Adapted-by | Sebastien Lelong, Joep Suijs, Rob Hamerling |
Compiler | >=2.4n |
USART common functions This file provides common functions to other libraries. Baudrate can simply be set through a constant in the application program, because the baudrate depending registers are calculated by this unit. Baudrate is calculated, starting at the high baudrate flag, which will ensure the highest possible accuracy.
No dependency found
_calculate_and_set_baudrate()
internal function, calculates and sets baudrate divider and stores it in the appropiate register. the high-speed / low-speed bit is not stored but returned as the result Special attention is payed to the highest and lowest baudrates, a deviation of 5% is accepted in these cases Asynchronous baudrate settings {{{ for ESUART (with 16 bits baudrate generator) SPBRGH/SPBRG = ( Fosc / ( 4 * Baudrate ) ) -1 if TXSTA_BRGH = 1 (high speed) SPBRG = ( Fosc / ( 16 * Baudrate ) ) -1 if TXSTA_BRGH = 0 (low speed) SPBRG = ( Fosc / ( 64 * Baudrate ) ) -1 }}} Synchronous baudrate settings: * TXSTA_BRGH = 0 (low speed) * SPBRG = ( Fosc / ( 4 * Baudrate ) ) -1
Author | Albert Faber, Copyright (c) 2008..2009, all rights reserved. |
Adapted-by | - |
Compiler | >=2.4j |
Constants for configurting the USB interface
http://www.usb.org for USB specifications
No dependency found
var volatile byte usb_bd3out_cnt at usb_bd3out[1]
var volatile word usb_bd2out_addr at usb_bd2out[2]
var volatile byte usb_bd1out_addrl at usb_bd1out[2]
var volatile bit EP3HSHK at UEP3:4
const word USB_IN_DELIVERY_BUFFER_LOC = ( USB_BASE_ADDRESS + 0x0078 )
var volatile word usb_bd5in_addr at usb_bd5in[2]
var volatile byte usb_bd0in_addrh at usb_bd0in[3]
const byte USB_CM_CTRL_WRITE_DATA_STAGE_CLASS = 2
var byte usb_state = USB_STATE_POWERED
const byte USB_PID_NYET = 0b00000110
const byte USB_CM_CTRL_WRITE_DATA_STAGE = 1
var volatile byte usb_bd1out_cnt at usb_bd1out[1]
const byte USB_PID_DATA0 = 0b00000011
var volatile byte usb_sdp_request_type at usb_sdp_loc
const byte USB_REQUEST_SET_ADDRESS = 0x05
const USB_REQUEST_TYPE1_BIT = 6
const byte USB_PID_OUT = 0b00000001
var volatile byte usb_bd2out_cnt at usb_bd2out[1]
var volatile byte usb_bd1out_addrh at usb_bd1out[3]
var volatile bit EP1OUTEN at UEP1:2
var volatile byte usb_bd0out_cnt at usb_bd0out[1]
var volatile byte usb_bd4in_stat at usb_bd4in[0]
const byte USB_BDSTATUS_INCDIS = 4
var volatile byte usb_bd2in_addrh at usb_bd2in[3]
const byte USB_PID_ACK = 0b00000010
var volatile byte usb_bd3in_stat at usb_bd3in[0]
const byte USB_BD_CNT_IDX = 0x01
const byte USB_EP_OUT_IN = 0x0E
const byte USB_FULL_SPEED = 0x04
var volatile byte usb_bd4out_addrh at usb_bd4out[3]
var volatile word usb_bd0out_addr at usb_bd0out[2]
var volatile byte usb_bd0out_addrl at usb_bd0out[2]
var volatile byte usb_sdp_request at usb_sdp_loc + 1
const byte USB_EXTERNAL_TRANSCEIVER = 0x08
var volatile byte usb_bd5out_stat at usb_bd5out[0]
const byte USB_CDC_DEVICE = 0x02
var volatile byte usb_bd3in_addrh at usb_bd3in[3]
const byte USB_EPT_INT = 0x03
var volatile bit EP3INEN at UEP3:1
const byte USB_STATE_CONFIGURED = 3
const byte USB_HID_PROTOCOL_MOUSE = 0x02
var volatile byte usb_bd5out_cnt at usb_bd5out[1]
const byte USB_ABSTRACT_CONTROL_MODEL = 0x02
var volatile byte usb_bd5in_stat at usb_bd5in[0]
var volatile bit EP3CONDIS at UEP3:3
var volatile byte usb_bd0in_cnt at usb_bd0in[1]
const byte USB_PING_PONG__EP0_OUT_ONLY = 0x01
const byte USB_COMM_INTF = 0x02
var volatile bit EP1CONDIS at UEP1:3
const byte USB_REQUEST_SET_INTERFACE = 0x0b
const byte USB_CM_CTRL_READ_AWAITING_STATUS = 5
var byte usb_control_mode
var volatile byte usb_bd4in_addrh at usb_bd4in[3]
var volatile byte usb_bd5out_addrl at usb_bd5out[2]
var volatile word usb_bd4in_addr at usb_bd4in[2]
const byte USB_PID_MDATA = 0b00001111
var volatile byte usb_bd4out[4] at ( USB_BASE_ADDRESS + 0x0020 )
const byte USB_DT_DEVICE_QUALIFIER = 0x06
const byte USB_CM_CTRL_READ_DATA_STAGE_CLASS = 4
var byte usb_delivery_bytes_to_send
var volatile byte usb_bd3out_addrh at usb_bd3out[3]
var volatile bit EP1STALL at UEP1:0
var volatile byte usb_bd5out[4] at ( USB_BASE_ADDRESS + 0x0028 )
const byte USB_PING_PONG__ALL_BUT_EP0 = 0x03
const byte USB_DT_OTG = 0x09
const USB_DEVICE_DESCRIPTOR_SIZE = 18
var volatile bit EP1INEN at UEP1:1
const byte USB_CM_IDLE = 0
var volatile bit EP2INEN at UEP2:1
const USB_REQUEST_TYPE0_BIT = 5
var volatile word usb_sdp_length at usb_sdp_loc + 6
var volatile byte usb_bd1in_addrh at usb_bd1in[3]
var volatile byte usb_bd0in_addrl at usb_bd0in[2]
const byte USB_REQUEST_GET_STATUS = 0x00
const byte USB_STATUS_SET_ADDRESS = 1
const byte USB_DT_OTHER_SPEED_CONFIG = 0x07
var volatile byte usb_bd4out_cnt at usb_bd4out[1]
var volatile byte usb_bd4out_addrl at usb_bd4out[2]
var volatile byte usb_bd4in_addrl at usb_bd4in[2]
const byte USB_PID_SETUP = 0b00001101
const byte USB_PID_IN = 0b00001001
const byte USB_REQUEST_GET_INTERFACE = 0x0a
const byte USB_DT_HID_REPORT = 0x22
const byte USB_REQUEST_REQ_SYNCH_FRAME = 0x0c
var volatile bit EP3OUTEN at UEP3:2
var volatile byte usb_bd5in[4] at ( USB_BASE_ADDRESS + 0x002C )
var volatile byte usb_bd2out[4] at ( USB_BASE_ADDRESS + 0x0010 )
const byte USB_DT_DEBUG = 0x0a
const byte USB_CM_CTRL_READ_DATA_STAGE = 3
var volatile byte usb_bd1out[4] at ( USB_BASE_ADDRESS + 0x0008 )
const byte USB_HID_INTF = 0x03
const byte USB_DT_STRING = 0x03
const bit USB_SELF_POWERED = 1
var volatile word usb_bd0in_addr at usb_bd0in[2]
var byte usb_delivery_buffer[ 8 ] at USB_IN_DELIVERY_BUFFER_LOC
const byte USB_BD_ADDRL_IDX = 0x03
var volatile word usb_bd1in_addr at usb_bd1in[2]
const byte USB_EP_OUT = 0x0C
var volatile byte usb_bd5in_cnt at usb_bd5in[1]
var volatile word usb_sdp_index at usb_sdp_loc + 4
var volatile byte usb_bd_array[ 255 ] at ( USB_BASE_ADDRESS + 0x0000 )
const byte USB_STATE_DEFAULT = 1
var volatile bit EP3STALL at UEP3:0
var byte usb_delivery_bytes_sent
const byte USB_BDSTATUS_UOWN = 7
var volatile byte usb_bd3out[4] at ( USB_BASE_ADDRESS + 0x0018 )
var volatile word usb_bd3in_addr at usb_bd3in[2]
const byte USB_PULLUP_DISABLED = 0x00
var volatile word usb_bd2in_addr at usb_bd2in[2]
var volatile byte usb_bd1in_stat at usb_bd1in[0]
var byte usb_delivery_bytes_max_send
var volatile byte usb_bd1in_cnt at usb_bd1in[1]
const byte USB_BOOT_INTF_SUBCLASS = 0x01
const byte USB_DT_HID = 0x21
var volatile byte usb_bd1in[4] at ( USB_BASE_ADDRESS + 0x000C )
const byte USB_BD_ADDRH_IDX = 0x02
var volatile byte usb_bd2out_addrl at usb_bd2out[2]
var volatile word usb_sdp_value at usb_sdp_loc + 2
const byte USB_BDSTATUS_KEN = 5
const byte USB_REQUEST_SET_DESCRIPTOR = 0x07
const byte USB_EPT_CTRL = 0x00
const byte USB_STATUS_IDLE = 0
const byte USB_PING_PONG__FULL_PING_PONG = 0x02
var volatile byte usb_bd4in_cnt at usb_bd4in[1]
const byte USB_HID_PROTOCOL_KEYBOARD = 0x01
var volatile bit EP2CONDIS at UEP2:3
var volatile byte usb_bd0in[4] at ( USB_BASE_ADDRESS + 0x0004 )
var volatile byte usb_bd3in_addrl at usb_bd3in[2]
const byte USB_DT_INTERFACE_ASSOC = 0x0b
const byte USB_BDSTATUS_BC8 = 0
const byte USB_HSHK_EN = 0x10
const byte USB_DT_ENDPOINT = 0x05
const byte USB_BDSTATUS_DTS = 6
var volatile byte usb_bd5in_addrh at usb_bd5in[3]
const byte USB_EPT_BULK = 0x02
var volatile word usb_bd3out_addr at usb_bd3out[2]
var volatile byte usb_bd2in_stat at usb_bd2in[0]
var byte usb_delivery_buffer_size
const byte USB_DT_CS_INTERFACE = 0x24
var volatile byte usb_bd0in_stat at usb_bd0in[0]
const byte USB_DT_CONFIGURATION = 0x02
const byte USB_CM_CTRL_WRITE_SENDING_STATUS = 6
var volatile byte usb_bd1in_addrl at usb_bd1in[2]
var volatile byte usb_bd3in_cnt at usb_bd3in[1]
var volatile byte usb_bd3in[4] at ( USB_BASE_ADDRESS + 0x001C )
const byte USB_PULLUP_ENABLE = 0x10
var volatile byte usb_bd0out_addrh at usb_bd0out[3]
const byte USB_REQUEST_SET_CONFIGURATION = 0x09
const byte USB_BDSTATUS_DTSEN = 3
var volatile bit EP2STALL at UEP2:0
var volatile bit EP2OUTEN at UEP2:2
var volatile word usb_bd4out_addr at usb_bd4out[2]
const byte USB_EP_IN = 0x0A
var volatile byte usb_bd2in_cnt at usb_bd2in[1]
var volatile byte usb_bd3out_stat at usb_bd3out[0]
var volatile byte usb_bd2in_addrl at usb_bd2in[2]
var volatile byte usb_bd4in[4] at ( USB_BASE_ADDRESS + 0x0024 )
const byte USB_HIGHEST_EP = 3
const USB_DATA_STAGE_DIR_BIT = 7
const byte USB_DT_DEVICE = 0x01
var volatile byte usb_bd5in_addrl at usb_bd5in[2]
const byte USB_DT_INTERFACE_POWER = 0x08
var byte usb_status
const byte USB_V25TER = 0x01
const byte USB_STATE_ADDRESS = 2
const byte USB_PID_DATA1 = 0b00001011
const byte USB_BDSTATUS_BSTALL = 2
const byte USB_EP_CTRL = 0x06
const byte USB_VENDOR_INTF = 0xFF
var volatile byte usb_bd1out_stat at usb_bd1out[0]
var volatile byte usb_bd2out_addrh at usb_bd2out[3]
const byte USB_PID_SOF = 0b00000101
const word usb_sdp_loc = ( USB_BASE_ADDRESS + 0x00F8 )
var volatile byte usb_bd3out_addrl at usb_bd3out[2]
const byte USB_HID_PROTOCOL_NONE = 0x00
var volatile bit EP2HSHK at UEP2:4
const byte USB_INTERNAL_TRANSCEIVER = 0x00
const byte USB_PID_STALL = 0b00001110
const byte USB_DT_INTERFACE = 0x04
var volatile word usb_bd1out_addr at usb_bd1out[2]
var volatile byte usb_bd0out[4] at ( USB_BASE_ADDRESS + 0x0000 )
const byte USB_REQUEST_SET_FEATURE = 0x03
var volatile byte usb_bd4out_stat at usb_bd4out[0]
var volatile byte usb_bd2in[4] at ( USB_BASE_ADDRESS + 0x0014 )
var volatile word usb_bd5out_addr at usb_bd5out[2]
const byte USB_PID_NAK = 0b00001010
const byte USB_EPT_ISO = 0x01
var byte usb_address
const byte USB_LOW_SPEED = 0x00
var volatile byte usb_sdp[8] at usb_sdp_loc
const byte USB_REQUEST_GET_DESCRIPTOR = 0x06
var volatile bit EP1HSHK at UEP1:4
const byte USB_STATE_POWERED = 0
var volatile byte usb_bd0out_stat at usb_bd0out[0]
const byte USB_PID_DATA2 = 0b00000111
const byte USB_BD_STAT_IDX = 0x00
const byte USB_BDSTATUS_BC9 = 1
var volatile byte usb_bd5out_addrh at usb_bd5out[3]
var volatile byte usb_bd2out_stat at usb_bd2out[0]
const byte USB_PING_PONG__NO_PING_PONG = 0x00
const byte USB_REQUEST_GET_CONFIGURATION = 0x08
const byte USB_REQUEST_CLEAR_FEATURE = 0x01
var volatile byte usb_bd3out_cnt at usb_bd3out[1]
No documentation found
var volatile word usb_bd2out_addr at usb_bd2out[2]
No documentation found
var volatile byte usb_bd1out_addrl at usb_bd1out[2]
No documentation found
var volatile bit EP3HSHK at UEP3:4
No documentation found
const word USB_IN_DELIVERY_BUFFER_LOC = ( USB_BASE_ADDRESS + 0x0078 )
No documentation found
var volatile word usb_bd5in_addr at usb_bd5in[2]
No documentation found
var volatile byte usb_bd0in_addrh at usb_bd0in[3]
No documentation found
const byte USB_CM_CTRL_WRITE_DATA_STAGE_CLASS = 2
Device receiving data during the data stage destined for the class
var byte usb_state = USB_STATE_POWERED
No documentation found
const byte USB_PID_NYET = 0b00000110
No documentation found
const byte USB_CM_CTRL_WRITE_DATA_STAGE = 1
Device receiving data during the data stage
var volatile byte usb_bd1out_cnt at usb_bd1out[1]
No documentation found
const byte USB_PID_DATA0 = 0b00000011
Data
var volatile byte usb_sdp_request_type at usb_sdp_loc
No documentation found
const byte USB_REQUEST_SET_ADDRESS = 0x05
No documentation found
const USB_REQUEST_TYPE1_BIT = 6
00= USB standard request
const byte USB_PID_OUT = 0b00000001
Token
var volatile byte usb_bd2out_cnt at usb_bd2out[1]
No documentation found
var volatile byte usb_bd1out_addrh at usb_bd1out[3]
No documentation found
var volatile bit EP1OUTEN at UEP1:2
No documentation found
var volatile byte usb_bd0out_cnt at usb_bd0out[1]
No documentation found
var volatile byte usb_bd4in_stat at usb_bd4in[0]
No documentation found
const byte USB_BDSTATUS_INCDIS = 4
1 Address increment disabled (for SPP), 0 address increment enabled
var volatile byte usb_bd2in_addrh at usb_bd2in[3]
No documentation found
const byte USB_PID_ACK = 0b00000010
Handshake
var volatile byte usb_bd3in_stat at usb_bd3in[0]
No documentation found
const byte USB_BD_CNT_IDX = 0x01
No documentation found
const byte USB_EP_OUT_IN = 0x0E
Cfg both OUT & IN pipes for this ep
const byte USB_FULL_SPEED = 0x04
No documentation found
var volatile byte usb_bd4out_addrh at usb_bd4out[3]
No documentation found
var volatile word usb_bd0out_addr at usb_bd0out[2]
No documentation found
var volatile byte usb_bd0out_addrl at usb_bd0out[2]
No documentation found
var volatile byte usb_sdp_request at usb_sdp_loc + 1
No documentation found
const byte USB_EXTERNAL_TRANSCEIVER = 0x08
No documentation found
var volatile byte usb_bd5out_stat at usb_bd5out[0]
No documentation found
const byte USB_CDC_DEVICE = 0x02
Device Class Code
var volatile byte usb_bd3in_addrh at usb_bd3in[3]
No documentation found
const byte USB_EPT_INT = 0x03
Interrupt Transfer
var volatile bit EP3INEN at UEP3:1
No documentation found
const byte USB_STATE_CONFIGURED = 3
USB device is completely configured and ready to rock and roll
const byte USB_HID_PROTOCOL_MOUSE = 0x02
No documentation found
var volatile byte usb_bd5out_cnt at usb_bd5out[1]
No documentation found
const byte USB_ABSTRACT_CONTROL_MODEL = 0x02
Communication Interface Class SubClass Codes
var volatile byte usb_bd5in_stat at usb_bd5in[0]
No documentation found
var volatile bit EP3CONDIS at UEP3:3
No documentation found
var volatile byte usb_bd0in_cnt at usb_bd0in[1]
No documentation found
const byte USB_PING_PONG__EP0_OUT_ONLY = 0x01
0b01
const byte USB_COMM_INTF = 0x02
Communication Interface Class Code
var volatile bit EP1CONDIS at UEP1:3
No documentation found
const byte USB_REQUEST_SET_INTERFACE = 0x0b
No documentation found
const byte USB_CM_CTRL_READ_AWAITING_STATUS = 5
Device is awaiting reception of status after sending data
var byte usb_control_mode
No documentation found
var volatile byte usb_bd4in_addrh at usb_bd4in[3]
No documentation found
var volatile byte usb_bd5out_addrl at usb_bd5out[2]
No documentation found
var volatile word usb_bd4in_addr at usb_bd4in[2]
No documentation found
const byte USB_PID_MDATA = 0b00001111
No documentation found
var volatile byte usb_bd4out[4] at ( USB_BASE_ADDRESS + 0x0020 )
No documentation found
const byte USB_DT_DEVICE_QUALIFIER = 0x06
No documentation found
const byte USB_CM_CTRL_READ_DATA_STAGE_CLASS = 4
Device class is sending data during the data stage
var byte usb_delivery_bytes_to_send
No documentation found
var volatile byte usb_bd3out_addrh at usb_bd3out[3]
No documentation found
var volatile bit EP1STALL at UEP1:0
No documentation found
var volatile byte usb_bd5out[4] at ( USB_BASE_ADDRESS + 0x0028 )
No documentation found
const byte USB_PING_PONG__ALL_BUT_EP0 = 0x03
0b11
const byte USB_DT_OTG = 0x09
No documentation found
const USB_DEVICE_DESCRIPTOR_SIZE = 18
No documentation found
var volatile bit EP1INEN at UEP1:1
No documentation found
const byte USB_CM_IDLE = 0
USB COMMAND MODES
var volatile bit EP2INEN at UEP2:1
No documentation found
const USB_REQUEST_TYPE0_BIT = 5
01= Request for a specific class
var volatile word usb_sdp_length at usb_sdp_loc + 6
No documentation found
var volatile byte usb_bd1in_addrh at usb_bd1in[3]
No documentation found
var volatile byte usb_bd0in_addrl at usb_bd0in[2]
No documentation found
const byte USB_REQUEST_GET_STATUS = 0x00
USB REQUESTS
const byte USB_STATUS_SET_ADDRESS = 1
No documentation found
const byte USB_DT_OTHER_SPEED_CONFIG = 0x07
No documentation found
var volatile byte usb_bd4out_cnt at usb_bd4out[1]
No documentation found
var volatile byte usb_bd4out_addrl at usb_bd4out[2]
No documentation found
var volatile byte usb_bd4in_addrl at usb_bd4in[2]
No documentation found
const byte USB_PID_SETUP = 0b00001101
No documentation found
const byte USB_PID_IN = 0b00001001
No documentation found
const byte USB_REQUEST_GET_INTERFACE = 0x0a
No documentation found
const byte USB_DT_HID_REPORT = 0x22
No documentation found
const byte USB_REQUEST_REQ_SYNCH_FRAME = 0x0c
No documentation found
var volatile bit EP3OUTEN at UEP3:2
No documentation found
var volatile byte usb_bd5in[4] at ( USB_BASE_ADDRESS + 0x002C )
No documentation found
var volatile byte usb_bd2out[4] at ( USB_BASE_ADDRESS + 0x0010 )
No documentation found
const byte USB_DT_DEBUG = 0x0a
No documentation found
const byte USB_CM_CTRL_READ_DATA_STAGE = 3
Device sending data during the data stage
var volatile byte usb_bd1out[4] at ( USB_BASE_ADDRESS + 0x0008 )
No documentation found
const byte USB_HID_INTF = 0x03
No documentation found
const byte USB_DT_STRING = 0x03
No documentation found
const bit USB_SELF_POWERED = 1
No documentation found
var volatile word usb_bd0in_addr at usb_bd0in[2]
No documentation found
var byte usb_delivery_buffer[ 8 ] at USB_IN_DELIVERY_BUFFER_LOC
No documentation found
const byte USB_BD_ADDRL_IDX = 0x03
No documentation found
var volatile word usb_bd1in_addr at usb_bd1in[2]
No documentation found
const byte USB_EP_OUT = 0x0C
Cfg OUT only pipe for this ep
var volatile byte usb_bd5in_cnt at usb_bd5in[1]
No documentation found
var volatile word usb_sdp_index at usb_sdp_loc + 4
No documentation found
var volatile byte usb_bd_array[ 255 ] at ( USB_BASE_ADDRESS + 0x0000 )
No documentation found
const byte USB_STATE_DEFAULT = 1
USB device is now negotiating
var volatile bit EP3STALL at UEP3:0
No documentation found
var byte usb_delivery_bytes_sent
No documentation found
const byte USB_BDSTATUS_UOWN = 7
Bits of BDn.stat when UOWN = 0
var volatile byte usb_bd3out[4] at ( USB_BASE_ADDRESS + 0x0018 )
No documentation found
var volatile word usb_bd3in_addr at usb_bd3in[2]
No documentation found
const byte USB_PULLUP_DISABLED = 0x00
No documentation found
var volatile word usb_bd2in_addr at usb_bd2in[2]
No documentation found
var volatile byte usb_bd1in_stat at usb_bd1in[0]
No documentation found
var byte usb_delivery_bytes_max_send
No documentation found
var volatile byte usb_bd1in_cnt at usb_bd1in[1]
No documentation found
const byte USB_BOOT_INTF_SUBCLASS = 0x01
No documentation found
const byte USB_DT_HID = 0x21
No documentation found
var volatile byte usb_bd1in[4] at ( USB_BASE_ADDRESS + 0x000C )
No documentation found
const byte USB_BD_ADDRH_IDX = 0x02
No documentation found
var volatile byte usb_bd2out_addrl at usb_bd2out[2]
No documentation found
var volatile word usb_sdp_value at usb_sdp_loc + 2
No documentation found
const byte USB_BDSTATUS_KEN = 5
1 USB will keep buffer indefinately, 0 USB will hand back buffer
const byte USB_REQUEST_SET_DESCRIPTOR = 0x07
No documentation found
const byte USB_EPT_CTRL = 0x00
Endpoint Transfer Type
const byte USB_STATUS_IDLE = 0
USB_STATUS
const byte USB_PING_PONG__FULL_PING_PONG = 0x02
0b10
var volatile byte usb_bd4in_cnt at usb_bd4in[1]
No documentation found
const byte USB_HID_PROTOCOL_KEYBOARD = 0x01
No documentation found
var volatile bit EP2CONDIS at UEP2:3
No documentation found
var volatile byte usb_bd0in[4] at ( USB_BASE_ADDRESS + 0x0004 )
No documentation found
var volatile byte usb_bd3in_addrl at usb_bd3in[2]
No documentation found
const byte USB_DT_INTERFACE_ASSOC = 0x0b
No documentation found
const byte USB_BDSTATUS_BC8 = 0
bit 8 of buffer count
const byte USB_HSHK_EN = 0x10
Enable handshake packet
const byte USB_DT_ENDPOINT = 0x05
No documentation found
const byte USB_BDSTATUS_DTS = 6
1 data 1 packet, 0 data 0 packet
var volatile byte usb_bd5in_addrh at usb_bd5in[3]
No documentation found
const byte USB_EPT_BULK = 0x02
Bulk Transfer
var volatile word usb_bd3out_addr at usb_bd3out[2]
No documentation found
var volatile byte usb_bd2in_stat at usb_bd2in[0]
No documentation found
var byte usb_delivery_buffer_size
No documentation found
const byte USB_DT_CS_INTERFACE = 0x24
No documentation found
var volatile byte usb_bd0in_stat at usb_bd0in[0]
No documentation found
const byte USB_DT_CONFIGURATION = 0x02
No documentation found
const byte USB_CM_CTRL_WRITE_SENDING_STATUS = 6
Device is sending status after receiving data
var volatile byte usb_bd1in_addrl at usb_bd1in[2]
No documentation found
var volatile byte usb_bd3in_cnt at usb_bd3in[1]
No documentation found
var volatile byte usb_bd3in[4] at ( USB_BASE_ADDRESS + 0x001C )
No documentation found
const byte USB_PULLUP_ENABLE = 0x10
No documentation found
var volatile byte usb_bd0out_addrh at usb_bd0out[3]
No documentation found
const byte USB_REQUEST_SET_CONFIGURATION = 0x09
No documentation found
const byte USB_BDSTATUS_DTSEN = 3
1 data toggle sync on, 0 data toggle sync off
var volatile bit EP2STALL at UEP2:0
No documentation found
var volatile bit EP2OUTEN at UEP2:2
No documentation found
var volatile word usb_bd4out_addr at usb_bd4out[2]
No documentation found
const byte USB_EP_IN = 0x0A
Cfg IN only pipe for this ep
var volatile byte usb_bd2in_cnt at usb_bd2in[1]
No documentation found
var volatile byte usb_bd3out_stat at usb_bd3out[0]
No documentation found
var volatile byte usb_bd2in_addrl at usb_bd2in[2]
No documentation found
var volatile byte usb_bd4in[4] at ( USB_BASE_ADDRESS + 0x0024 )
No documentation found
const byte USB_HIGHEST_EP = 3
No documentation found
const USB_DATA_STAGE_DIR_BIT = 7
No documentation found
const byte USB_DT_DEVICE = 0x01
No documentation found
var volatile byte usb_bd5in_addrl at usb_bd5in[2]
No documentation found
const byte USB_DT_INTERFACE_POWER = 0x08
No documentation found
var byte usb_status
No documentation found
const byte USB_V25TER = 0x01
Communication Interface Class Control Protocol Codes
const byte USB_STATE_ADDRESS = 2
USB device now has an address
const byte USB_PID_DATA1 = 0b00001011
No documentation found
const byte USB_BDSTATUS_BSTALL = 2
1 buffer stall enabled, 0 buffer stall disabled
const byte USB_EP_CTRL = 0x06
Cfg Control pipe for this ep
const byte USB_VENDOR_INTF = 0xFF
Vendor specific interface code
var volatile byte usb_bd1out_stat at usb_bd1out[0]
No documentation found
var volatile byte usb_bd2out_addrh at usb_bd2out[3]
No documentation found
const byte USB_PID_SOF = 0b00000101
No documentation found
const word usb_sdp_loc = ( USB_BASE_ADDRESS + 0x00F8 )
No documentation found
var volatile byte usb_bd3out_addrl at usb_bd3out[2]
No documentation found
const byte USB_HID_PROTOCOL_NONE = 0x00
HID Interface Class Protocol Codes
var volatile bit EP2HSHK at UEP2:4
No documentation found
const byte USB_INTERNAL_TRANSCEIVER = 0x00
No documentation found
const byte USB_PID_STALL = 0b00001110
No documentation found
const byte USB_DT_INTERFACE = 0x04
No documentation found
var volatile word usb_bd1out_addr at usb_bd1out[2]
No documentation found
var volatile byte usb_bd0out[4] at ( USB_BASE_ADDRESS + 0x0000 )
No documentation found
const byte USB_REQUEST_SET_FEATURE = 0x03
No documentation found
var volatile byte usb_bd4out_stat at usb_bd4out[0]
No documentation found
var volatile byte usb_bd2in[4] at ( USB_BASE_ADDRESS + 0x0014 )
No documentation found
var volatile word usb_bd5out_addr at usb_bd5out[2]
No documentation found
const byte USB_PID_NAK = 0b00001010
No documentation found
const byte USB_EPT_ISO = 0x01
Isochronous Transfer
var byte usb_address
No documentation found
const byte USB_LOW_SPEED = 0x00
No documentation found
var volatile byte usb_sdp[8] at usb_sdp_loc
No documentation found
const byte USB_REQUEST_GET_DESCRIPTOR = 0x06
No documentation found
var volatile bit EP1HSHK at UEP1:4
No documentation found
const byte USB_STATE_POWERED = 0
USB STATE
var volatile byte usb_bd0out_stat at usb_bd0out[0]
No documentation found
const byte USB_PID_DATA2 = 0b00000111
No documentation found
const byte USB_BD_STAT_IDX = 0x00
No documentation found
const byte USB_BDSTATUS_BC9 = 1
bit 9 of buffer count
var volatile byte usb_bd5out_addrh at usb_bd5out[3]
No documentation found
var volatile byte usb_bd2out_stat at usb_bd2out[0]
No documentation found
const byte USB_PING_PONG__NO_PING_PONG = 0x00
0b00
const byte USB_REQUEST_GET_CONFIGURATION = 0x08
No documentation found
const byte USB_REQUEST_CLEAR_FEATURE = 0x01
No documentation found
18f14k50 | 18f14k50_usb_hid_mouse.jal |
18f14k50 | 18f14k50_usb_hid_generic.jal |
18f14k50 | 18f14k50_usb_bootloader_autostart.jal |
18f14k50 | 18f14k50_usb_bootloader.jal |
18f2450 | 18f2450_usb_bootloader.jal |
18f2450 | 18f2450_usb_bootloader_autostart.jal |
18f2450 | 18f2450_usb_hid_generic.jal |
18f2450 | 18f2450_usb_hid_mouse.jal |
18f4550 | 18f4550_usb_bootloader_autostart.jal |
18f4550 | 18f4550_usb_bootloader.jal |
18f4550 | 18f4550_usb_hid_mouse.jal |
18f4550 | 18f4550_usb_hid_generic.jal |
Author | Albert Faber, Copyright (c) 2008..2009, all rights reserved. |
Adapted-by | - |
Compiler | >=2.4j |
This file contains the lowl level USB driver routines. It constrols the USB serial interface engine, by managing the input and output transfers, and calling the defined callback function when required
http://www.usb.org ; for USB specifications http://www.lvr.com/usbc.htm ; a lot of information about USB http://www.beyondlogic.org/ ; also a nice with with useful information
No dependency found
usb_enable_module()
Procedure to turn on the USB device
usb_handle_stall()
Procedure can be called when the USB device has to be stalled
usb_setup()
Procedure to intialize the USB device, it will only do the setup, to enable the USB device, use the usb_enable() procedure
usb_handle_isr()
This is the heard of the USB library, all pending IO transfers are handled by this main (interrupt) service routine. For the PIC USB device it does not make much sense to use real interrupts since all real time aspects are handle by the SIE. Therefore this usb_handle_isr() must be polled on a regular base, in order to to keep the input and output transfers flowing
_usb_handle_standard_request()
Internal procedure to handle standard USB requests it will take care of the overall state of the device performing USB buffer management controlling the SIE and call the callback function if required
_usb_ints_on()
Internal procedure to set the correct interrupt flags, note that for PIC USB device it does not make much sense to use real interrupts since all real time aspects are handle by the SIE. However, the library does use the interrupt flags, this procedure will setup to proper interrupt flags
_usb_handle_transaction()
Internal procedure to handle the USB transactions it will take care of the overall state of the device performing USB buffer management controlling the SIE and call the callback function if required
_usb_handle_reset()
Internal procedure to reset the USB device
usb_is_configured() return bit
Function returns true if the usb device has been completely configured, otherwise return value will be false
usb_get_state() return byte
Get the state of the USB device USB_STATE_POWERED -> USB device is powered up, ready to start negotiating USB_STATE_DEFAULT -> USB device is now negotiating USB_STATE_ADDRESS -> USB device now has an address USB_STATE_CONFIGURED -> USB device is completely configured and ready to rock and roll
18f14k50 | 18f14k50_usb_hid_mouse.jal |
18f14k50 | 18f14k50_usb_hid_generic.jal |
18f14k50 | 18f14k50_usb_bootloader_autostart.jal |
18f14k50 | 18f14k50_usb_bootloader.jal |
18f2450 | 18f2450_usb_bootloader.jal |
18f2450 | 18f2450_usb_bootloader_autostart.jal |
18f2450 | 18f2450_usb_hid_generic.jal |
18f2450 | 18f2450_usb_hid_mouse.jal |
18f4550 | 18f4550_usb_bootloader_autostart.jal |
18f4550 | 18f4550_usb_bootloader.jal |
18f4550 | 18f4550_usb_hid_mouse.jal |
18f4550 | 18f4550_usb_hid_generic.jal |
Author | Albert Faber, Copyright (c) 2008..2009, all rights reserved. |
Adapted-by | - |
Compiler | >=2.4j |
USB Communication Device Class (CDC) code This USB library files contains the low level implementation to perform serial communication over a USB interface. The usage of this library requires detailed knowledge of the USB interface and requires that several configuration parameters are defined correctly. In order to make USB serial communication more accessible for the end user, I would highly recommend to use the usb_serial library
http://www.usb.org for USB specifications
No dependency found
var volatile byte cdc_rx_wr = 0
const byte USB_REQ_GET_ENCAPSULATED_RESPONSE = 0x01
var volatile byte cdc_tx_wr=0
var byte cdc_line_status = 0x00
var volatile dword cdc_line_coding_dte_rate at cdc_line_coding[0]
const byte USB_REQ_SEND_BREAK = 0x23
var volatile byte cdc_rx_rd = 0
var volatile byte cdc_tx_rd=0
const byte USB_REQ_GET_LINE_CODING = 0x21
const byte USB_REQ_SET_LINE_CODING = 0x20
var volatile byte cdc_rx_free = USB_CDC_RX_BUFFER_SIZE
var byte cdc_rx_buffer[USB_CDC_RX_BUFFER_SIZE]
const byte USB_REQ_SET_COMM_FEATURE = 0x02
var volatile byte cdc_line_coding_parity at cdc_line_coding[5]
var volatile byte cdc_line_coding_stop_bits at cdc_line_coding[4]
const byte USB_REQ_CLEAR_COMM_FEATURE = 0x04
var volatile byte cdc_line_coding[7]
var bit last_packet_is_full = false
var volatile byte cdc_line_coding_data_bits at cdc_line_coding[6]
const byte USB_REQ_SEND_ENCAPSULATED_COMMAND = 0x00
const byte USB_REQ_SET_CONTROL_LINE_STATE = 0x22
usb_handle_class_request_callback()
usb_handle_class_ctrl_read_callback()
usb_ep_data_out_callback(byte in end_point, word in buffer_addr, byte in byte_count)
usb_cdc_putc(byte in c)
usb_cdc_handle_tx()
usb_ep_data_in_callback(byte in end_point, word in buffer_addr, byte in byte_count)
usb_handle_class_ctrl_write_callback()
usb_sof_callback()
usb_cdc_setup()
usb_cdc_rx_avail() return bit
does_sie_owns_tx_buffer() return bit
usb_cdc_line_status() return byte
usb_cdc_getc() return byte
usb_cdc_tx_empty() return byte
var volatile byte cdc_rx_wr = 0
No documentation found
const byte USB_REQ_GET_ENCAPSULATED_RESPONSE = 0x01
No documentation found
var volatile byte cdc_tx_wr=0
No documentation found
var byte cdc_line_status = 0x00
No documentation found
var volatile dword cdc_line_coding_dte_rate at cdc_line_coding[0]
No documentation found
const byte USB_REQ_SEND_BREAK = 0x23
No documentation found
var volatile byte cdc_rx_rd = 0
No documentation found
var volatile byte cdc_tx_rd=0
No documentation found
const byte USB_REQ_GET_LINE_CODING = 0x21
No documentation found
const byte USB_REQ_SET_LINE_CODING = 0x20
No documentation found
var volatile byte cdc_rx_free = USB_CDC_RX_BUFFER_SIZE
No documentation found
var byte cdc_rx_buffer[USB_CDC_RX_BUFFER_SIZE]
No documentation found
const byte USB_REQ_SET_COMM_FEATURE = 0x02
No documentation found
var volatile byte cdc_line_coding_parity at cdc_line_coding[5]
0=None, 1=Odd, 2=Even, 3=Mark, 4=Space
var volatile byte cdc_line_coding_stop_bits at cdc_line_coding[4]
0=1 stop bit, 1=1.5 stop bits, 2=2 stop bits
const byte USB_REQ_CLEAR_COMM_FEATURE = 0x04
No documentation found
var volatile byte cdc_line_coding[7]
No documentation found
var bit last_packet_is_full = false
No documentation found
var volatile byte cdc_line_coding_data_bits at cdc_line_coding[6]
5,6,7,8 or 16 bits
const byte USB_REQ_SEND_ENCAPSULATED_COMMAND = 0x00
No documentation found
const byte USB_REQ_SET_CONTROL_LINE_STATE = 0x22
No documentation found
usb_handle_class_request_callback()
No documentation found
usb_handle_class_ctrl_read_callback()
No documentation found
usb_ep_data_out_callback(byte in end_point, word in buffer_addr, byte in byte_count)
No documentation found
usb_cdc_putc(byte in c)
This usb_cdc_putc will transmit the specified character. Under normal conditions the character to be transmitted is placed into the fifo, so the call will be non blocking. This implies that buffer overruns can occur when the transmit FIFO is full. Therefore it is adviced to check the transmit FIFO state before calling this procedure to avoid buffer overruns. These buffer overrun issues have been addressed in the usb_serial library, therefore it is highly recommended to use this library instead of calling this low level procedure
usb_cdc_handle_tx()
This procedure will handle the transmission of the (bulk) data. The procedure check if there are pending characters in the tranmit FIFO. These character(s) are send in chunk(s), the chunk size is dependent on the conifguration of the bulk interface endpoint
usb_ep_data_in_callback(byte in end_point, word in buffer_addr, byte in byte_count)
This function is called when data can be transmitted via the bulk interface
usb_handle_class_ctrl_write_callback()
No documentation found
usb_sof_callback()
No documentation found
usb_cdc_setup()
This procedure will intialize the line status of the communicatin device class
usb_cdc_rx_avail() return bit
This function returns there has been a character received, function will return true if there is at least one pending receive character, false otherwise
does_sie_owns_tx_buffer() return bit
This function returns the status of the SIE tx buffer. Either the SIE can own the transmit buffer (tranmit is pending) or it can be owned by the CPU. This function return true if the SIE owns the buffer, otherwise false is returned
usb_cdc_line_status() return byte
This function returns the line status. If on the host side the COM port has not been opened, the return status will be 0x00, otherwise it will be != 0
usb_cdc_getc() return byte
This usb_cdc_getc function wait (blocking) until a character has been received. The byte value of the received character is returned by this function
usb_cdc_tx_empty() return byte
This function returns the empty status of the transmit FIFO, it will return true if transmit FIFO is empty, false otherwise
Author | Albert Faber, Copyright (c) 2008..2009, all rights reserved. |
Adapted-by | - |
Compiler | >=2.4j |
Routines for controlling the USB serial interface engine sending which will ensure the highest possible accuracy.
http://www.usb.org for USB specifications
No dependency found
usb_send_one_byte(byte in data)
usb_stall_ep0()
usb_prime_epx_out( byte in end_point, byte in size )
usb_send_empty_data_pkt()
usb_send_status_ack()
usb_send_data_chunk()
usb_send_data(byte in endpoint, byte in data[], byte in byte_cnt, bit in is_new_sequence )
usb_configure_endpoints()
usb_prime_ep0_out()
usb_send_one_byte(byte in data)
This procedure will send one byte, with the contend specified by the data input parameter, normally not called by the end user
usb_stall_ep0()
No documentation found
usb_prime_epx_out( byte in end_point, byte in size )
No documentation found
usb_send_empty_data_pkt()
This procedure sends an empty USB packet, normally not called by the end user
usb_send_status_ack()
This procedure sends an USB acknowledge packet, normally not called by the end user
usb_send_data_chunk()
This procedure sends the content of the USB delivery buffer in the USB SIE
usb_send_data(byte in endpoint, byte in data[], byte in byte_cnt, bit in is_new_sequence )
This procedure will send the content of an array to the USB end point. The endpoint input parameter contains the the enpoint number, data[] is the content to be send, byte_cnt the number of bytes to be send, and is_new_sequence determines if the data tranmission is starting with USB packet o (if set to true), otherwise the USB packet is toggled before transmission.
usb_configure_endpoints()
This procedure will setup and initalize the USB endpoints, normally not called by the end user
usb_prime_ep0_out()
No documentation found
_usb_copy_array_to_ram(word in dst, byte in data[], byte in num_bytes )
Internal memory copy procedure This function copies the content from a source array towards the specified destination memory location. The function copies num_bytes bytes
18f14k50 | 18f14k50_usb_hid_mouse.jal |
18f14k50 | 18f14k50_usb_hid_generic.jal |
18f14k50 | 18f14k50_usb_bootloader_autostart.jal |
18f14k50 | 18f14k50_usb_bootloader.jal |
18f2450 | 18f2450_usb_bootloader.jal |
18f2450 | 18f2450_usb_bootloader_autostart.jal |
18f2450 | 18f2450_usb_hid_generic.jal |
18f2450 | 18f2450_usb_hid_mouse.jal |
18f4550 | 18f4550_usb_bootloader_autostart.jal |
18f4550 | 18f4550_usb_bootloader.jal |
18f4550 | 18f4550_usb_hid_mouse.jal |
18f4550 | 18f4550_usb_hid_generic.jal |
Author | Albert Faber, Copyright (c) 2010, all rights reserved. |
Adapted-by | - |
Compiler | >=2.4j |
An easy to use USB HID keyboard library the USB interface. By default nothing has to be defined by the user, below an example how to use the library include usb_keyboard .. usb_keyboard_init() .. ;-- wait till USB becomes available while ( !usb_is_configured() ) loop end loop .. ;-- main loop var byte ch forever loop ; -- call the flush routine on a regular base in the main loop ; -- in order to keep the USB communicaiton alive usb_keyboard_flush() ..... if ( usb_is_configured() ) if ( pin_x ) ush_keyboard_send_key( 0x00, USB_KEYBOARD_KEY_A ) else ush_keyboard_send_key( 0x00, USB_KEYBOARD_KEY_NONE )
http://www.usb.org for USB specifications
-
const bit USB_EP1 = 1
var volatile bit _usb_keyboard_led_kana at _usb_keyboard_led_status:3
const USB_KEYBOARD_KEY_LEFT_CONTROL = 0xE0
const word USB_EP0_OUT_ADDR = ( USB_BASE_ADDRESS + 0x0010 )
const byte USB_HID_REQ_REPORT = 0x22
var volatile bit _usb_keyboard_led_caps_lock at _usb_keyboard_led_status:1
const byte USB_HID_ENDPOINT = 0x01
const USB_CONFIGURATION_DESCRIPTOR_SIZE = 0x09 + 0x09 + 0x09 + 0x07
const USB_KEYBOARD_KEY_F1 = 0x3A
const USB_KEYBOARD_KEY_U = 0x18
const USB_KEYBOARD_KEY_W = 0x1A
const USB_KEYBOARD_KEY_F7 = 0x40
const USB_KEYBOARD_KEY_5 = 0x22
const byte USB_HID_REQ_PHYSDISCR = 0x23
const USB_KEYBOARD_KEY_3 = 0x20
const byte USB_HID_REQ_HID = 0x21
const USB_KEYBOARD_KEY_RIGHT_SHIFT = 0xE5
const USB_KEYBOARD_KEY_T = 0x17
const USB_KEYBOARD_KEY_NONE = 0x00
const USB_KEYBOARD_KEY_A = 0x04
const USB_KEYBOARD_KEY_9 = 0x26
const USB_KEYBOARD_KEY_0 = 0x27
const USB_KEYBOARD_KEY_E = 0x08
const byte USB_EP2_OUT_SIZE = 8
const USB_KEYBOARD_MKEY_RIGHT_ALT = 0b_01000000
const USB_KEYBOARD_KEY_PAGEDOWN = 0x4E
var volatile bit _usb_hid_can_tx = true
const byte USB_HID_REPORT1[]=
const word USB_EP1_OUT_ADDR = ( USB_EP0_IN_ADDR + USB_EP0_IN_SIZE )
const USB_KEYBOARD_KEY_2 = 0x1F
const byte USB_HCR_SET_REPORT = 0x09
const USB_KEYBOARD_KEY_F2 = 0x3B
const USB_KEYBOARD_KEY_RIGHT_GUI = 0xE7
const USB_KEYBOARD_KEY_S = 0x16
const USB_KEYBOARD_KEY_4 = 0x21
const USB_KEYBOARD_KEY_F5 = 0x3E
const USB_KEYBOARD_KEY_F10 = 0x43
const USB_KEYBOARD_KEY_B = 0x05
const USB_KEYBOARD_KEY_P = 0x13
const USB_KEYBOARD_KEY_L = 0x0F
const USB_KEYBOARD_KEY_RIGHT_CONTROL = 0xE4
const bit USB_EP3 = 0
const USB_KEYBOARD_KEY_EQUAL_SIGN = 0x86
const USB_KEYBOARD_KEY_COMMA = 0x85
const USB_KEYBOARD_KEY_I = 0x0C
const USB_KEYBOARD_KEY_J = 0x0D
const byte USB_EP2_IN_SIZE = 8
const USB_KEYBOARD_KEY_PAGEUP = 0x4B
const USB_KEYBOARD_KEY_F12 = 0x45
const USB_KEYBOARD_KEY_F9 = 0x42
const USB_KEYBOARD_MKEY_RIGHT_SHIFT = 0b_00100000
const USB_KEYBOARD_KEY_F8 = 0x41
var volatile byte usb_ep1in_buf[ 8 ] at USB_EP1_IN_ADDR
const USB_KEYBOARD_KEY_F6 = 0x3F
const byte USB_EP3_OUT_SIZE = 8
const USB_KEYBOARD_MKEY_RIGHT_GUI = 0b_10000000
const USB_KEYBOARD_KEY_RIGHT_ALT = 0xE6
const byte USB_EP0_OUT_SIZE = 8
const USB_KEYBOARD_KEY_7 = 0x24
const bit USB_EP2 = 0
const USB_KEYBOARD_MKEY_LEFT_ALT = 0b_00000100
const USB_KEYBOARD_KEY_Q = 0x14
const USB_KEYBOARD_KEY_O = 0x12
const USB_KEYBOARD_KEY_F4 = 0x3D
const USB_KEYBOARD_KEY_NUM_LOCK = 0x83
const USB_KEYBOARD_KEY_SPACE = 0x2C
const USB_KEYBOARD_KEY_6 = 0x23
const USB_KEYBOARD_KEY_SCROLL_LOCK = 0x84
const USB_KEYBOARD_KEY_X = 0x1B
const word USB_EP3_IN_ADDR = 0x0000
const byte USB_EP0_IN_SIZE = 8
const USB_KEYBOARD_KEY_K = 0x0E
const USB_KEYBOARD_KEY_1 = 0x1E
const byte USB_EP1_IN_SIZE = 8
var byte _usb_keyboard_led_status = 0x00
const byte USB_HCR_SET_PROTOCOL = 0x0B
const USB_KEYBOARD_KEY_8 = 0x25
const USB_KEYBOARD_KEY_H = 0x0B
const word USB_EP2_IN_ADDR = 0x0000
const byte USB_HCR_GET_PROTOCOL = 0x03
const byte USB_EP1_OUT_SIZE = 8
const USB_KEYBOARD_KEY_D = 0x07
const USB_KEYBOARD_KEY_M = 0x10
const word USB_EP0_IN_ADDR = ( USB_EP0_OUT_ADDR + USB_EP0_OUT_SIZE )
var byte usb_kbd_report[8]
const USB_KEYBOARD_KEY_LEFT_ALT = 0xE2
const USB_KEYBOARD_KEY_G = 0x0A
const USB_KEYBOARD_KEY_Y = 0x1C
const byte USB_HCR_GET_REPORT = 0x01
const byte USB_CONFIGURATION_DESCRIPTOR[ USB_CONFIGURATION_DESCRIPTOR_SIZE ]=
const USB_KEYBOARD_MKEY_LEFT_SHIFT = 0b_00000010
const byte USB_DEVICE_DESCRIPTOR[USB_DEVICE_DESCRIPTOR_SIZE] = {
const USB_KEYBOARD_KEY_LEFT_SHIFT = 0xE1
const USB_KEYBOARD_KEY_LEFT_GUI = 0xE3
const bit USB_EP0 = 1
const word USB_EP3_OUT_ADDR = 0x0000
const USB_KEYBOARD_KEY_C = 0x06
const byte USB_STRING0[] =
const USB_KEYBOARD_KEY_N = 0x11
const word USB_EP2_OUT_ADDR = 0x0000
const USB_KEYBOARD_KEY_V = 0x19
var volatile bit _usb_keyboard_led_num_lock at _usb_keyboard_led_status:0
const USB_KEYBOARD_KEY_CAPS_LOCK = 0x82
const USB_KEYBOARD_KEY_F11 = 0x44
const byte USB_EP3_IN_SIZE = 8
const byte USB_HCR_SET_IDLE = 0x0A
const USB_KEYBOARD_KEY_F = 0x09
const USB_KEYBOARD_KEY_R = 0x15
const USB_KEYBOARD_KEY_F3 = 0x3C
const USB_KEYBOARD_KEY_Z = 0x1D
var volatile bit _usb_keyboard_led_compose at _usb_keyboard_led_status:2
const USB_KEYBOARD_MKEY_RIGHT_CTRL = 0b_00010000
const USB_KEYBOARD_MKEY_LEFT_GUI = 0b_00001000
const word USB_EP1_IN_ADDR = ( USB_EP1_OUT_ADDR + USB_EP1_OUT_SIZE )
const USB_KEYBOARD_MKEY_LEFT_CTRL = 0b_00000001
const byte USB_HCR_GET_IDLE = 0x02
usb_handle_class_request_callback()
ush_keyboard_send_key( byte in modifier_key, byte in key )
usb_handle_class_ctrl_read_callback()
usb_ep_data_in_callback(byte in end_point, word in buffer_addr, byte in byte_count)
usb_handle_class_ctrl_write_callback()
usb_keyboard_flush()
usb_keyboard_init()
usb_keyboard_led_num_lock'get() return bit
usb_keyboard_led_compose'get() return bit
usb_keyboard_led_caps_lock'get() return bit
usb_keyboard_led_kana'get() return bit
const bit USB_EP1 = 1
No documentation found
var volatile bit _usb_keyboard_led_kana at _usb_keyboard_led_status:3
No documentation found
const USB_KEYBOARD_KEY_LEFT_CONTROL = 0xE0
No documentation found
const word USB_EP0_OUT_ADDR = ( USB_BASE_ADDRESS + 0x0010 )
No documentation found
const byte USB_HID_REQ_REPORT = 0x22
No documentation found
var volatile bit _usb_keyboard_led_caps_lock at _usb_keyboard_led_status:1
No documentation found
const byte USB_HID_ENDPOINT = 0x01
No documentation found
const USB_CONFIGURATION_DESCRIPTOR_SIZE = 0x09 + 0x09 + 0x09 + 0x07
No documentation found
const USB_KEYBOARD_KEY_F1 = 0x3A
No documentation found
const USB_KEYBOARD_KEY_U = 0x18
No documentation found
const USB_KEYBOARD_KEY_W = 0x1A
No documentation found
const USB_KEYBOARD_KEY_F7 = 0x40
No documentation found
const USB_KEYBOARD_KEY_5 = 0x22
No documentation found
const byte USB_HID_REQ_PHYSDISCR = 0x23
No documentation found
const USB_KEYBOARD_KEY_3 = 0x20
No documentation found
const byte USB_HID_REQ_HID = 0x21
No documentation found
const USB_KEYBOARD_KEY_RIGHT_SHIFT = 0xE5
No documentation found
const USB_KEYBOARD_KEY_T = 0x17
No documentation found
const USB_KEYBOARD_KEY_NONE = 0x00
List with keyboard code definitions, note keycodes are not equivalent with the ASCII codes
const USB_KEYBOARD_KEY_A = 0x04
No documentation found
const USB_KEYBOARD_KEY_9 = 0x26
No documentation found
const USB_KEYBOARD_KEY_0 = 0x27
No documentation found
const USB_KEYBOARD_KEY_E = 0x08
No documentation found
const byte USB_EP2_OUT_SIZE = 8
No documentation found
const USB_KEYBOARD_MKEY_RIGHT_ALT = 0b_01000000
No documentation found
const USB_KEYBOARD_KEY_PAGEDOWN = 0x4E
No documentation found
var volatile bit _usb_hid_can_tx = true
No documentation found
const byte USB_HID_REPORT1[]=
No documentation found
const word USB_EP1_OUT_ADDR = ( USB_EP0_IN_ADDR + USB_EP0_IN_SIZE )
No documentation found
const USB_KEYBOARD_KEY_2 = 0x1F
No documentation found
const byte USB_HCR_SET_REPORT = 0x09
No documentation found
const USB_KEYBOARD_KEY_F2 = 0x3B
No documentation found
const USB_KEYBOARD_KEY_RIGHT_GUI = 0xE7
No documentation found
const USB_KEYBOARD_KEY_S = 0x16
No documentation found
const USB_KEYBOARD_KEY_4 = 0x21
No documentation found
const USB_KEYBOARD_KEY_F5 = 0x3E
No documentation found
const USB_KEYBOARD_KEY_F10 = 0x43
No documentation found
const USB_KEYBOARD_KEY_B = 0x05
No documentation found
const USB_KEYBOARD_KEY_P = 0x13
No documentation found
const USB_KEYBOARD_KEY_L = 0x0F
No documentation found
const USB_KEYBOARD_KEY_RIGHT_CONTROL = 0xE4
No documentation found
const bit USB_EP3 = 0
No documentation found
const USB_KEYBOARD_KEY_EQUAL_SIGN = 0x86
No documentation found
const USB_KEYBOARD_KEY_COMMA = 0x85
No documentation found
const USB_KEYBOARD_KEY_I = 0x0C
No documentation found
const USB_KEYBOARD_KEY_J = 0x0D
No documentation found
const byte USB_EP2_IN_SIZE = 8
No documentation found
const USB_KEYBOARD_KEY_PAGEUP = 0x4B
No documentation found
const USB_KEYBOARD_KEY_F12 = 0x45
No documentation found
const USB_KEYBOARD_KEY_F9 = 0x42
No documentation found
const USB_KEYBOARD_MKEY_RIGHT_SHIFT = 0b_00100000
No documentation found
const USB_KEYBOARD_KEY_F8 = 0x41
No documentation found
var volatile byte usb_ep1in_buf[ 8 ] at USB_EP1_IN_ADDR
No documentation found
const USB_KEYBOARD_KEY_F6 = 0x3F
No documentation found
const byte USB_EP3_OUT_SIZE = 8
No documentation found
const USB_KEYBOARD_MKEY_RIGHT_GUI = 0b_10000000
No documentation found
const USB_KEYBOARD_KEY_RIGHT_ALT = 0xE6
No documentation found
const byte USB_EP0_OUT_SIZE = 8
No documentation found
const USB_KEYBOARD_KEY_7 = 0x24
No documentation found
const bit USB_EP2 = 0
No documentation found
const USB_KEYBOARD_MKEY_LEFT_ALT = 0b_00000100
No documentation found
const USB_KEYBOARD_KEY_Q = 0x14
No documentation found
const USB_KEYBOARD_KEY_O = 0x12
No documentation found
const USB_KEYBOARD_KEY_F4 = 0x3D
No documentation found
const USB_KEYBOARD_KEY_NUM_LOCK = 0x83
No documentation found
const USB_KEYBOARD_KEY_SPACE = 0x2C
No documentation found
const USB_KEYBOARD_KEY_6 = 0x23
No documentation found
const USB_KEYBOARD_KEY_SCROLL_LOCK = 0x84
No documentation found
const USB_KEYBOARD_KEY_X = 0x1B
No documentation found
const word USB_EP3_IN_ADDR = 0x0000
No documentation found
const byte USB_EP0_IN_SIZE = 8
No documentation found
const USB_KEYBOARD_KEY_K = 0x0E
No documentation found
const USB_KEYBOARD_KEY_1 = 0x1E
No documentation found
const byte USB_EP1_IN_SIZE = 8
No documentation found
var byte _usb_keyboard_led_status = 0x00
No documentation found
const byte USB_HCR_SET_PROTOCOL = 0x0B
No documentation found
const USB_KEYBOARD_KEY_8 = 0x25
No documentation found
const USB_KEYBOARD_KEY_H = 0x0B
No documentation found
const word USB_EP2_IN_ADDR = 0x0000
No documentation found
const byte USB_HCR_GET_PROTOCOL = 0x03
No documentation found
const byte USB_EP1_OUT_SIZE = 8
No documentation found
const USB_KEYBOARD_KEY_D = 0x07
No documentation found
const USB_KEYBOARD_KEY_M = 0x10
No documentation found
const word USB_EP0_IN_ADDR = ( USB_EP0_OUT_ADDR + USB_EP0_OUT_SIZE )
No documentation found
var byte usb_kbd_report[8]
No documentation found
const USB_KEYBOARD_KEY_LEFT_ALT = 0xE2
No documentation found
const USB_KEYBOARD_KEY_G = 0x0A
No documentation found
const USB_KEYBOARD_KEY_Y = 0x1C
No documentation found
const byte USB_HCR_GET_REPORT = 0x01
No documentation found
const byte USB_CONFIGURATION_DESCRIPTOR[ USB_CONFIGURATION_DESCRIPTOR_SIZE ]=
No documentation found
const USB_KEYBOARD_MKEY_LEFT_SHIFT = 0b_00000010
No documentation found
const byte USB_DEVICE_DESCRIPTOR[USB_DEVICE_DESCRIPTOR_SIZE] = {
No documentation found
const USB_KEYBOARD_KEY_LEFT_SHIFT = 0xE1
No documentation found
const USB_KEYBOARD_KEY_LEFT_GUI = 0xE3
No documentation found
const bit USB_EP0 = 1
No documentation found
const word USB_EP3_OUT_ADDR = 0x0000
No documentation found
const USB_KEYBOARD_KEY_C = 0x06
No documentation found
const byte USB_STRING0[] =
No documentation found
const USB_KEYBOARD_KEY_N = 0x11
No documentation found
const word USB_EP2_OUT_ADDR = 0x0000
No documentation found
const USB_KEYBOARD_KEY_V = 0x19
No documentation found
var volatile bit _usb_keyboard_led_num_lock at _usb_keyboard_led_status:0
No documentation found
const USB_KEYBOARD_KEY_CAPS_LOCK = 0x82
No documentation found
const USB_KEYBOARD_KEY_F11 = 0x44
No documentation found
const byte USB_EP3_IN_SIZE = 8
No documentation found
const byte USB_HCR_SET_IDLE = 0x0A
No documentation found
const USB_KEYBOARD_KEY_F = 0x09
No documentation found
const USB_KEYBOARD_KEY_R = 0x15
No documentation found
const USB_KEYBOARD_KEY_F3 = 0x3C
No documentation found
const USB_KEYBOARD_KEY_Z = 0x1D
No documentation found
var volatile bit _usb_keyboard_led_compose at _usb_keyboard_led_status:2
No documentation found
const USB_KEYBOARD_MKEY_RIGHT_CTRL = 0b_00010000
No documentation found
const USB_KEYBOARD_MKEY_LEFT_GUI = 0b_00001000
No documentation found
const word USB_EP1_IN_ADDR = ( USB_EP1_OUT_ADDR + USB_EP1_OUT_SIZE )
No documentation found
const USB_KEYBOARD_MKEY_LEFT_CTRL = 0b_00000001
List with modifier keyboard code definitions
const byte USB_HCR_GET_IDLE = 0x02
No documentation found
usb_handle_class_request_callback()
No documentation found
ush_keyboard_send_key( byte in modifier_key, byte in key )
ush_keyboard_send_key - send a key code (blocking!) ush_keyboard_send_key() sends a key code toward the USB HID host the call is blocking and assumes that the HID communcation channel has been established. See also definitions for key codes (starting with USB_KEYBOARD_KEY_xxxx) and for the modifier key definitions starting with USB_KEYBOARD_MKEY_. Note that once a key code has been send, the HID host assumes that the key remains pressed, until a USB_KEYBOARD_KEY_NONE (or other key) is send towards the HID host
usb_handle_class_ctrl_read_callback()
No documentation found
usb_ep_data_in_callback(byte in end_point, word in buffer_addr, byte in byte_count)
No documentation found
usb_handle_class_ctrl_write_callback()
No documentation found
usb_keyboard_flush()
usb_keyboard_flush shall be called on a regular base (millisecond range) in order to keep the USB communcation alive. Therfore it is adviced to call the usb_keyboard _flush procedure in the main loop of your application
usb_keyboard_init()
usb_keyboard_init will setup the HID USB communication with the HOST, however, this can be a time consuming process, therefore this call is non blocking. In order to check if communication with the HOST has been established, one can call the usb_is_configured() function, see usb_is_configured() documentation for additional details.
_usb_hid_tx_report( byte in hid_report_in[], byte in cnt )
_usb_hid_tx_report, internal function to send a HID report
usb_keyboard_led_num_lock'get() return bit
usb_keyboard_led_num_lock - return the keyboard LED status of the num lock LED ( 0 = off, 1 = on )
usb_keyboard_led_compose'get() return bit
usb_keyboard_led_compose - return the keyboard LED status of the compose LED ( 0 = off, 1 = on )
usb_keyboard_led_caps_lock'get() return bit
usb_keyboard_led_caps_lock - return the keyboard LED status of the caps lock LED ( 0 = off, 1 = on )
usb_keyboard_led_kana'get() return bit
usb_keyboard_led_kana - return the keyboard LED status of the kana LED ( 0 = off, 1 = on )
18f14k50 | 18f14k50_usb_hid_keyboard.jal |
18f2450 | 18f2450_usb_hid_keyboard.jal |
18f4550 | 18f4550_usb_hid_keyboard.jal |
Author | Albert Faber, Copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4k |
The library will ease the use of for serial communication over the USB interface. By default nothing has to be defined by the user, below an example how to use the library include usb_serial .. usb_serial_init() .. ;-- optionally wait till USB becomes available while ( usb_cdc_line_status() == 0x00 ) loop end loop .. ;-- main loop var byte ch forever loop ; -- call the flush routine on a regular base in the main loop ; -- in order to keep the USB communicaiton alive usb_serial_flush() if ( usb_serial_read( ch ) ) usb_serial_data = ch -- echo end if ..... end loop In addition this library can be used in combination with other JAL libraries, like print.jal and format.jal, for example to send a string, one can use the following code fragment: const byte str[] = "Hello World" print_string( usb_serial_data, str ) customization The usb_serial library offers the following custimization prameters, the user has the ability to set these const parameter(s) before the inclusion of the usb_serial file const byte USB_CDC_RX_BUFFER_SIZE = 0x?? -- set receive FIFO size const byte USB_CDC_TX_BUFFER_SIZE = 0x?? -- set transmit FIFO size const word USB_SERIAL_PRODUCT_ID = 0x???? -- set USB device product ID const word USB_SERIAL_VENDOR_ID = 0x???? -- set USB device vendor ID const byte USB_STRING0[] = { .. } -- set USB language string const byte USB_STRING1[] = { .. } -- set USB mfg string const byte USB_STRING2[] = { .. } -- set USB product string
-
const word USB_EP2_IN_ADDR = (USB_EP2_OUT_ADDR + USB_EP2_OUT_SIZE )
const byte USB_EP3_OUT_SIZE = 8
const bit USB_EP1 = 1
const byte USB_DSC_FN_RPT_CAPABILITIES = 0x05
const byte USB_CONFIGURATION_DESCRIPTOR[ USB_CONFIGURATION_DESCRIPTOR_SIZE ]=
const byte USB_DSC_FN_UNION = 0x06
const byte USB_CS_INTERFACE = 0x24
const byte USB_DSC_FN_CALL_MGT = 0x01
const byte USB_DCS_INTERFACE = 0x04
const byte USB_DEVICE_DESCRIPTOR[USB_DEVICE_DESCRIPTOR_SIZE] = {
const word USB_EP2_OUT_ADDR = (USB_BASE_ADDRESS + 0x0040 )
var volatile byte usb_cdc_eptx_buffer[USB_EP3_IN_SIZE] at USB_EP3_IN_ADDR
var volatile byte usb_ep3in_buf[ USB_EP3_IN_SIZE ] at USB_EP3_IN_ADDR
const byte USB_CDC_RX_BUFFER_SIZE = 0x10
const bit USB_EP2 = 1
const word USB_EP1_IN_ADDR = (USB_EP1_OUT_ADDR + USB_EP1_OUT_SIZE )
const bit USB_EP3 = 1
var volatile byte usb_ep2out_buf[ USB_EP2_OUT_SIZE ] at USB_EP2_OUT_ADDR
const word USB_EP0_OUT_ADDR = (USB_BASE_ADDRESS + 0x0020 )
const byte USB_CDC_DATA_ENDPOINT = 3
const byte USB_STRING0[] =
const byte USB_STRING1[0x36] =
var volatile byte usb_ep1out_buf[ USB_EP1_OUT_SIZE ] at USB_EP1_OUT_ADDR
const byte USB_DSC_FN_COUNTRY_SELECTION = 0x07
const byte USB_CDC_INT_EP_SIZE = 8
var volatile byte usb_ep1in_buf[ USB_EP1_IN_SIZE ] at USB_EP1_IN_ADDR
const word USB_EP0_IN_ADDR = (USB_EP0_OUT_ADDR + USB_EP0_OUT_SIZE )
const word USB_SERIAL_VENDOR_ID = 0x04D8
const byte USB_STRING2[30] =
var volatile byte usb_ep0out_buf[ USB_EP0_OUT_SIZE ] at USB_EP0_OUT_ADDR
const byte USB_CDC_BULK_OUT_EP_SIZE = USB_EP3_OUT_SIZE
const word USB_EP3_IN_ADDR = (USB_EP3_OUT_ADDR + USB_EP3_OUT_SIZE )
const byte USB_CDC_COMM_INTF_ID = 0x00
const byte USB_EP3_IN_SIZE = 8
var volatile byte usb_ep3out_buf[ USB_EP3_OUT_SIZE ] at USB_EP3_OUT_ADDR
const word USB_CDC_BULK_IN_EP_ADDR = USB_EP3_IN_ADDR
const byte USB_DSC_FN_USB_TERMINAL = 0x09
const word USB_SERIAL_PRODUCT_ID = 0x000A
const byte USB_DSC_FN_TELEPHONE_RINGER = 0x04
const byte USB_CDC_DATA_INTF = 0x0A
const byte USB_EP0_OUT_SIZE = 8
const byte USB_EP1_IN_SIZE = 8
const byte USB_CS_ENDPOINT = 0x25
const byte USB_DSC_FN_TEL_OP_MODES = 0x08
const bit USB_EP0 = 1
const byte USB_EP0_IN_SIZE = 8
const byte USB_EP2_IN_SIZE = 8
const byte USB_CDC_BULK_IN_EP_SIZE = USB_EP3_IN_SIZE
var volatile byte usb_ep2in_buf[ USB_EP2_IN_SIZE ] at USB_EP2_IN_ADDR
const word USB_EP3_OUT_ADDR = (USB_BASE_ADDRESS + 0x0050 )
const byte USB_EP1_OUT_SIZE = 8
const USB_CONFIGURATION_DESCRIPTOR_SIZE = 0x09 + 0x09 + 0x05 + 0x04 + 0x05 + 0x05 + 0x07 + 0x09 + 0x07 + 0x07
var volatile byte usb_ep0in_buf[ USB_EP0_IN_SIZE ] at USB_EP0_IN_ADDR
const byte USB_EP2_OUT_SIZE = 8
const byte USB_DSC_FN_ACM = 0x02
var volatile byte usb_cdc_eprx_buffer[USB_EP3_OUT_SIZE] at USB_EP3_OUT_ADDR
const word USB_EP1_OUT_ADDR = (USB_BASE_ADDRESS + 0x0030 )
const word USB_CDC_BULK_OUT_EP_ADDR = USB_EP3_OUT_ADDR
const byte USB_DSC_FN_HEADER = 0x00
const byte USB_CDC_NO_PROTOCOL = 0x00
const byte USB_CDC_TX_BUFFER_SIZE = 0x20
const byte USB_DSC_FN_DLM = 0x03
const byte USB_CDC_DATA_INTF_ID = 0x01
usb_serial_data'put(byte in data)
usb_serial_init()
usb_serial_flush()
usb_serial_write(byte in data)
usb_serial_data'get() return byte
usb_serial_data_available'get() return bit
usb_serial_port_open'get() return bit
usb_serial_read(byte out data) return bit
const word USB_EP2_IN_ADDR = (USB_EP2_OUT_ADDR + USB_EP2_OUT_SIZE )
No documentation found
const byte USB_EP3_OUT_SIZE = 8
No documentation found
const bit USB_EP1 = 1
No documentation found
const byte USB_DSC_FN_RPT_CAPABILITIES = 0x05
No documentation found
const byte USB_CONFIGURATION_DESCRIPTOR[ USB_CONFIGURATION_DESCRIPTOR_SIZE ]=
Sets the default USB_CONFIGURATION_DESCRIPTOR record. It is not expected that the user of the usb_serial library needs to create its own record. However, if needed in exeptional cases, the user has the ability to define the const byte USB_CONFIGURATION_DESCRIPTOR[] before inclusion of the usb_serial library to customize the USB conifguration
const byte USB_DSC_FN_UNION = 0x06
No documentation found
const byte USB_CS_INTERFACE = 0x24
No documentation found
const byte USB_DSC_FN_CALL_MGT = 0x01
No documentation found
const byte USB_DCS_INTERFACE = 0x04
No documentation found
const byte USB_DEVICE_DESCRIPTOR[USB_DEVICE_DESCRIPTOR_SIZE] = {
Sets the default USB_DEVICE_DESCRIPTOR record. It is not expected that the user of the usb_serial library needs to create its own record. However, if needed in exeptional cases, the user has the ability to define the const byte USB_DEVICE_DESCRIPTOR[USB_DEVICE_DESCRIPTOR_SIZE] before inclusion of the usb_serial library
const word USB_EP2_OUT_ADDR = (USB_BASE_ADDRESS + 0x0040 )
No documentation found
var volatile byte usb_cdc_eptx_buffer[USB_EP3_IN_SIZE] at USB_EP3_IN_ADDR
No documentation found
var volatile byte usb_ep3in_buf[ USB_EP3_IN_SIZE ] at USB_EP3_IN_ADDR
No documentation found
const byte USB_CDC_RX_BUFFER_SIZE = 0x10
USB_CDC_RX_BUFFER_SIZE contains the size of the receive FIFO buffer a large(r) buffer can speed up the transmission speed at the cost of free memory space. The user of the usb_serial library has the ability to control size of the FIFO buffer, by defining the const byte USB_CDC_RX_BUFFER_SIZE = 0x?? before the inclusion of the usb_serial file
const bit USB_EP2 = 1
No documentation found
const word USB_EP1_IN_ADDR = (USB_EP1_OUT_ADDR + USB_EP1_OUT_SIZE )
No documentation found
const bit USB_EP3 = 1
No documentation found
var volatile byte usb_ep2out_buf[ USB_EP2_OUT_SIZE ] at USB_EP2_OUT_ADDR
No documentation found
const word USB_EP0_OUT_ADDR = (USB_BASE_ADDRESS + 0x0020 )
No documentation found
const byte USB_CDC_DATA_ENDPOINT = 3
No documentation found
const byte USB_STRING0[] =
USB_STRING0 shall contain the USB strings language ID The user has the ability to define the string content of USB_STRING0 before inclusion of the usb_serial library to override the default content ( 0x0904 ). note that the USB shall contain 16 bit unicode characters, little endian encoded, and that the first field of USB_STRING0 shall contain the size of the entire USB_STRING0 array, the second byte shall be set to USB_DT_STRING (=0x03).
const byte USB_STRING1[0x36] =
USB_STRING1 shall contain the USB device descriptor string The user has the ability to define the string content of USB_STRING1 before inclusion of the usb_serial library to override the default content ("Microchip Technology Inc."). note that the USB shall contain 16 bit unicode characters, little endian encoded, and that the first field of USB_STRING1 shall contain the size of the entire USB_STRING1 array, the second byte shall be set to USB_DT_STRING (=0x03).
var volatile byte usb_ep1out_buf[ USB_EP1_OUT_SIZE ] at USB_EP1_OUT_ADDR
No documentation found
const byte USB_DSC_FN_COUNTRY_SELECTION = 0x07
No documentation found
const byte USB_CDC_INT_EP_SIZE = 8
set the size of the interrupt interface
var volatile byte usb_ep1in_buf[ USB_EP1_IN_SIZE ] at USB_EP1_IN_ADDR
No documentation found
const word USB_EP0_IN_ADDR = (USB_EP0_OUT_ADDR + USB_EP0_OUT_SIZE )
No documentation found
const word USB_SERIAL_VENDOR_ID = 0x04D8
USB_SERIAL_VENDOR_ID is set to Microchip if const is not defined by the user of the usb_serial library. One can set the USB_SERIAL_VENDOR_ID by defining the const before inclusion of the usb_serial library
const byte USB_STRING2[30] =
USB_STRING2 shall contain the USB product descriptor string The user has the ability to define the string content of USB_STRING1 before inclusion of the usb_serial library to override the default content ("JAL Serial."). note that the USB shall contain 16 bit unicode characters, little endian encoded, and that the first field of USB_STRING1 shall contain the size of the entire USB_STRING2 array, the second byte shall be set to USB_DT_STRING (=0x03).
var volatile byte usb_ep0out_buf[ USB_EP0_OUT_SIZE ] at USB_EP0_OUT_ADDR
No documentation found
const byte USB_CDC_BULK_OUT_EP_SIZE = USB_EP3_OUT_SIZE
No documentation found
const word USB_EP3_IN_ADDR = (USB_EP3_OUT_ADDR + USB_EP3_OUT_SIZE )
No documentation found
const byte USB_CDC_COMM_INTF_ID = 0x00
set the communication interface ID
const byte USB_EP3_IN_SIZE = 8
No documentation found
var volatile byte usb_ep3out_buf[ USB_EP3_OUT_SIZE ] at USB_EP3_OUT_ADDR
No documentation found
const word USB_CDC_BULK_IN_EP_ADDR = USB_EP3_IN_ADDR
No documentation found
const byte USB_DSC_FN_USB_TERMINAL = 0x09
No documentation found
const word USB_SERIAL_PRODUCT_ID = 0x000A
USB_SERIAL_PRODUCT_ID is set to Microchip CDC if const is not defined by the user of the usb_serial library can set the USB_SERIAL_PRODUCT_ID by defining the const before inclusion of the usb_serial library
const byte USB_DSC_FN_TELEPHONE_RINGER = 0x04
No documentation found
const byte USB_CDC_DATA_INTF = 0x0A
No documentation found
const byte USB_EP0_OUT_SIZE = 8
No documentation found
const byte USB_EP1_IN_SIZE = 8
No documentation found
const byte USB_CS_ENDPOINT = 0x25
No documentation found
const byte USB_DSC_FN_TEL_OP_MODES = 0x08
No documentation found
const bit USB_EP0 = 1
No documentation found
const byte USB_EP0_IN_SIZE = 8
No documentation found
const byte USB_EP2_IN_SIZE = 8
No documentation found
const byte USB_CDC_BULK_IN_EP_SIZE = USB_EP3_IN_SIZE
No documentation found
var volatile byte usb_ep2in_buf[ USB_EP2_IN_SIZE ] at USB_EP2_IN_ADDR
No documentation found
const word USB_EP3_OUT_ADDR = (USB_BASE_ADDRESS + 0x0050 )
No documentation found
const byte USB_EP1_OUT_SIZE = 8
No documentation found
const USB_CONFIGURATION_DESCRIPTOR_SIZE = 0x09 + 0x09 + 0x05 + 0x04 + 0x05 + 0x05 + 0x07 + 0x09 + 0x07 + 0x07
No documentation found
var volatile byte usb_ep0in_buf[ USB_EP0_IN_SIZE ] at USB_EP0_IN_ADDR
No documentation found
const byte USB_EP2_OUT_SIZE = 8
No documentation found
const byte USB_DSC_FN_ACM = 0x02
ACM - Abstract Control Management
var volatile byte usb_cdc_eprx_buffer[USB_EP3_OUT_SIZE] at USB_EP3_OUT_ADDR
No documentation found
const word USB_EP1_OUT_ADDR = (USB_BASE_ADDRESS + 0x0030 )
No documentation found
const word USB_CDC_BULK_OUT_EP_ADDR = USB_EP3_OUT_ADDR
No documentation found
const byte USB_DSC_FN_HEADER = 0x00
No documentation found
const byte USB_CDC_NO_PROTOCOL = 0x00
No class specific protocol required
const byte USB_CDC_TX_BUFFER_SIZE = 0x20
USB_CDC_TX_BUFFER_SIZE contains the size of the transmit FIFO buffer a large(r) buffer can speed up the transmission speed at the cost of free memory space. The user of the usb_serial library has the ability to control size of the FIFO buffer, by defining the const byte USB_CDC_TX_BUFFER_SIZE = 0x?? before the inclusion of the usb_serial file
const byte USB_DSC_FN_DLM = 0x03
DLM - Direct Line Managment
const byte USB_CDC_DATA_INTF_ID = 0x01
set the interrupt interface ID
usb_serial_data'put(byte in data)
usb_serial_data'put - write char to the USB port, blocking Asynchronuous serial send routine, using the USB Cummunication class Sends byte X (8 bit) to the USB host (via virtual COM port) Note that characters are dropped when the communcation channel on the USB host side is not opened (yet), this is a design choice in order to avoid lockup(s)
usb_serial_init()
usb_serial_init will setup the USB communication, however, this can be a time consuming process, therefore this call is non blocking. In order to check if the USB device has established contact with the HOST USB device, one can call the usb_is_configured() function, see usb_is_configured() documentation for additional details.
usb_serial_flush()
usb_serial_flush shall be called on a regular base (millisecond range) in order to keep the USB transmision alive. Therfore it is adviced to call the usb_serial_flush procedure in the main loop of your application
usb_serial_write(byte in data)
usb_serial_write - write char to the USB port, blocking Asynchronuous serial send routine, using the USB Cummunication class Sends byte X (8 bit) to the USB host (via virtual COM port) Checks (and waits if necessary) if FIFO buffer is full Note that characters are dropped when the communcation channel on the USB host side is not opened (yet), this is a design choice in order to avoid lockup(s)
usb_serial_data'get() return byte
usb_serial_data'get() - read a char (blocking!) usb_serial_data'get() waits till a character has been received and returns it
usb_serial_data_available'get() return bit
No documentation found
usb_serial_port_open'get() return bit
Check if the serial port has been opened by the host.
usb_serial_read(byte out data) return bit
usb_serial_read - read char if available (non-blocking) usb_serial_read returns true if a character has been received, otherwise returns false. If function returns true, the data variable is valid, and contains the character that has been received. In other cases the data variable is not defined Note that characters are dropped when the communcation channel on the USB host side is not opened (yet), this is a design choice in order to avoid lockup(s)
_usb_serial_read(byte out data) return bit
_usb_serial_read - internal use only! _usb_serial_read returns true if a character has been received, otherwise returns false. If function returns true, the data variable is valid, and contains the character that has been received. In other cases the data variable is not defined Note that characters are dropped when the communcation channel on the USB host side is not opened (yet), this is a design choice in order to avoid lockup(s)
18f14k50 | 18f14k50_usb_serial.jal |
18f2450 | 18f2450_usb_serial.jal |
18f4550 | 18f4550_ir2serial.jal |
18f4550 | 18f4550_usb_serial.jal |