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://jallib.blogspot.com for details...
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, adc_pindef.jal and adc_clock.jal. A major trigger 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 volatile byte _adcon0_shadow = 0
No documentation found
var byte adc_conversion_delay
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.jal |
16f877 | 16f877_adc_dependent.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.4k |
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, Vref+ and Vref- are part of these combinations. 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. About Vref setup: - when ADC_NVREF = 1: there's only one Vref, this is Vref+ - when ADC_NVREF = 2: two Vref are used, Vref+ and Vref- - when ADC_NVREF = 3: there's only one Vref, this is Vref- (not user-friendly)
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_vcfg()
Configure Voltage reference using VCFG bits
Author | Sebastien Lelong, Copyright (c) 2009, all rights reserved. |
Adapted-by | Sebastien Lelong. |
Compiler | >=2.4k |
this library provides a procedure to configure ADC clock according to ADC constraints about Tad values and PIC's clock speed
No dependency found
var byte tad_value
No documentation found
_adc_init_clock()
No documentation found
_adc_eval_tad(word in factor) return bit
No documentation found
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 word _BIT_ARRAY_1_ARRAY_SIZE = (BIT_ARRAY_1_SIZE / 8)+ 1
const byte _BIT_ARRAY_1_CALC3 = BIT_ARRAY_1_SIZE - _BIT_ARRAY_1_CALC1
const byte _BIT_ARRAY_1_CALC1 = BIT_ARRAY_1_SIZE / 8
const byte _BIT_ARRAY_1_CALC2 = _BIT_ARRAY_1_CALC1 * 8
const word _BIT_ARRAY_1_ARRAY_SIZE = (BIT_ARRAY_1_SIZE / 8)+ 1
No documentation found
const byte _BIT_ARRAY_1_CALC3 = BIT_ARRAY_1_SIZE - _BIT_ARRAY_1_CALC1
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_CALC2 = _BIT_ARRAY_1_CALC1 * 8
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 |
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()
No documentation found
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 bit can_adapter_is_open = 0
var volatile byte can_ascii_rxbuf[32]
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 bit can_adapter_is_open = 0
No documentation found
var volatile byte can_ascii_rxbuf[32]
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_can_serial_adapter.jal |
18f2585 | 18f2585_can_serial_hw.jal |
18f2585 | 18f2585_canid4_serial_adapter.jal |
18f2585 | 18f2585_canid4_monitor.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
const CANLED_OFF = 0
var byte can_led_red_func = CANLED_OFF
const CANLED_4FLASH = 0x48
const CANLED_1FLASH = 0x18
var byte can_led_state = 0
var byte can_led_red_opcode = CANLED_OFF
const CANLED_BLINK = 4
const CANLED_RED_ON = 2
const CANLED_2FLASH = 0x28
const CANLED_3FLASH = 0x38
const CANLED_GREEN_ON = 1
var byte can_led_green_opcode = CANLED_OFF
var byte can_led_green_func = CANLED_OFF
const CANLED_FLASH = 8
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()
const CANLED_OFF = 0
No documentation found
var byte can_led_red_func = CANLED_OFF
No documentation found
const CANLED_4FLASH = 0x48
No documentation found
const CANLED_1FLASH = 0x18
No documentation found
var byte can_led_state = 0
No documentation found
var byte can_led_red_opcode = CANLED_OFF
No documentation found
const CANLED_BLINK = 4
No documentation found
const CANLED_RED_ON = 2
No documentation found
const CANLED_2FLASH = 0x28
No documentation found
const CANLED_3FLASH = 0x38
No documentation found
const CANLED_GREEN_ON = 1
No documentation found
var byte can_led_green_opcode = CANLED_OFF
No documentation found
var byte can_led_green_func = CANLED_OFF
No documentation found
const CANLED_FLASH = 8
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_can_serial_hw.jal |
18f2585 | 18f2585_canid4_serial_adapter.jal |
18f2585 | 18f2585_can_serial_adapter.jal |
18f2585 | 18f2585_can_monitor.jal |
18f2585 | 18f2585_canid4_monitor.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_RXB0SIDH = 0x61
const CAN_READ_RX0_DATA = 0x92
const CAN_WAKFIL_DISABLE = 0x00
const CAN_CLKOUT_PS4 = 0x02
const CAN_READ_RX1_DATA = 0x96
const CAN_SJW4 = 0xC0
const CAN_TXB1EID8 = 0x43
const CAN_MODE_LISTENONLY = 0x60
const CANINTF = 0x2C
const CAN_RXB1SIDH = 0x71
const CAN_RXF4SIDH = 0x14
const CAN_RXF0SIDH = 0x00
const CAN_RXM0SIDH = 0x20
const CAN_SAMPLE_1X = 0x00
const CAN_RXF3SIDH = 0x10
const CAN_REC = 0x1D
const CAN_TXB2EID0 = 0x54
const CAN_TXB1D1 = 0x47
const CAN_MODE_NORMAL = 0x00
const CAN_RXB1SIDL = 0x72
const CAN_TXB2SIDL = 0x52
const CAN_RXF2EID0 = 0x0B
const CAN_TXB0D6 = 0x3C
const CAN_RXF1EID8 = 0x06
const CAN_RXB1EID0 = 0x74
const CAN_RXF5SIDL = 0x19
const CAN_CNF2 = 0x29
const CAN_RXB1D7 = 0x7D
const CAN_TXB2SIDH = 0x51
const CAN_WAKIF = 0x40
const CAN_RXM1EID0 = 0x27
const CAN_TX1IE = 0x08
const CAN_TXB2D0 = 0x56
const CAN_RXF5SIDH = 0x18
const CANSTAT = 0x0E
const CAN_RXM1SIDH = 0x24
const CAN_RTS_TX2 = 0x84
const CAN_TXB0D2 = 0x38
const CAN_RXB0D2 = 0x68
const CAN_RXF2SIDL = 0x09
const CAN_TXB2D4 = 0x5A
const CAN_TXB2D5 = 0x5B
const CAN_TXB0CTRL = 0x30
const CAN_TXB0D5 = 0x3B
const CAN_MODE_SLEEP = 0x20
const CAN_RXM1SIDL = 0x25
const CAN_MODE_ONESHOT = 0x08
const CAN_RXF4SIDL = 0x15
const CAN_CLKOUT_PS8 = 0x03
const CAN_RX0IE = 0x01
const CAN_RXF1EID0 = 0x07
const CAN_RXB0SIDL = 0x62
const CAN_ABORT_TX = 0x10
const CAN_TXB2CTRL = 0x50
const CAN_RXF0EID8 = 0x02
const CAN_RXF2EID8 = 0x0A
const CAN_TXB1D4 = 0x4A
const CAN_RTS_TX0 = 0x81
const CAN_CLKOUT_PS2 = 0x01
const CAN_RXB0D4 = 0x6A
const CAN_TXB1D2 = 0x48
const CAN_TXB0DLC = 0x35
const CAN_RXB1EID8 = 0x73
const CAN_TXB1D5 = 0x4B
const CAN_RXB1CTRL = 0x70
const CAN_RXM0SIDL = 0x21
const CAN_MERRE = 0x80
const CAN_TXB2D7 = 0x5D
const CAN_TXB2D3 = 0x59
const CAN_SOF_DISABLE = 0x00
const CAN_RTS_TX1 = 0x82
const CAN_RTS_ALL = 0x87
const CAN_RX_STATUS_CMD = 0xB0
const CAN_RXF2SIDH = 0x08
const CAN_MERRF = 0x80
const CAN_LOAD_TX2 = 0x44
const CAN_RXB0DLC = 0x65
const CAN_TXB0D4 = 0x3A
const CAN_TX2IE = 0x10
const CAN_CLKOUT_ENABLE = 0x04
const CAN_TXB1DLC = 0x45
const CAN_RXB0EID0 = 0x64
const CAN_TX2IF = 0x10
const CAN_TXB1D7 = 0x4D
const CAN_RXF5EID8 = 0x1A
const CAN_RXF4EID0 = 0x17
const CAN_RXB0D3 = 0x69
const CAN_ERRIF = 0x20
const CAN_TXB2D1 = 0x57
const CAN_TXB1SIDH = 0x41
const CAN_MODE_POWERUP = 0xE0
const CAN_RXB1D3 = 0x79
const CAN_TXB1D0 = 0x46
const CAN_RXB0CTRL = 0x60
const CAN_RXF5EID0 = 0x1B
const CAN_WRITE_CMD = 0x02
const CAN_TXB0D7 = 0x3D
const CAN_TXB0SIDH = 0x31
const CAN_RXF1SIDH = 0x04
const CAN_TXB2D2 = 0x58
const CAN_SOF_ENABLE = 0x80
const CAN_TEC = 0x1C
const CAN_RXF1SIDL = 0x05
const CAN_WAKFIL_ENABLE = 0x40
const CAN_TXB2EID8 = 0x53
const CAN_RXB1DLC = 0x75
const CANCTRL = 0x0F
const CAN_RXB1D5 = 0x7B
const CAN_SAMPLE_3X = 0x40
const CAN_MODE_LOOPBACK = 0x40
const CAN_RXB0D1 = 0x67
const CAN_TX0IF = 0x04
const CAN_TX0IE = 0x04
const CAN_TX1IF = 0x08
const CAN_CNF3 = 0x28
const CAN_TXB0D1 = 0x37
const CAN_RXB0D0 = 0x66
const CAN_RXM0EID0 = 0x23
const CAN_LOAD_TX1 = 0x42
const CAN_RXM0EID8 = 0x22
const CAN_RXF0EID0 = 0x03
const CAN_RX1IE = 0x02
const CAN_BITMOD = 0x05
const CAN_WAKIE = 0x40
const CAN_READ_CMD = 0x03
const CAN_TXB0EID8 = 0x33
const CAN_LOAD_TX0 = 0x40
const CAN_TXB1CTRL = 0x40
const CAN_RXB1D4 = 0x7A
const CAN_BTLMODE = 0x80
const CAN_RXF4EID8 = 0x16
const CAN_RXB1D6 = 0x7C
const CAN_RXB0D5 = 0x6B
const CAN_TXB1D3 = 0x49
const CAN_ERRIE = 0x20
const CAN_RXF3EID0 = 0x13
const CAN_RXF0SIDL = 0x01
const CAN_SJW2 = 0x40
const CAN_RXF3EID8 = 0x12
const CAN_RXM1EID8 = 0x26
const CAN_TXB1SIDL = 0x42
const CAN_MODE_MASK = 0xE0
const CAN_READ_STATUS_CMD = 0xA0
const CAN_MODE_CONFIG = 0x80
const CAN_RXB0D6 = 0x6C
const CAN_TXB0SIDL = 0x32
const CAN_RESET_CMD = 0xC0
const CAN_TXB1EID0 = 0x44
const CAN_TXB0D3 = 0x39
const CAN_RXB0D7 = 0x6D
const CAN_SJW1 = 0x00
const CAN_EFLG = 0x2D
const CANINTE = 0x2B
const CAN_RX1IF = 0x02
const CAN_SJW3 = 0x80
const CAN_RXB1D2 = 0x78
const CAN_RX0IF = 0x01
const CAN_CLKOUT_DISABLE = 0x00
const CAN_TXB0EID0 = 0x34
const CAN_TXB2DLC = 0x55
const CAN_TXB0D0 = 0x36
const CAN_RXF3SIDL = 0x11
const CAN_CLKOUT_PS1 = 0x00
const CAN_CNF1 = 0x2A
const CAN_TXB1D6 = 0x4C
const CAN_TXB2D6 = 0x5C
const CAN_RXB1D0 = 0x76
const CAN_RXB0EID8 = 0x63
const CAN_RXB1D1 = 0x77
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_RXB0SIDH = 0x61
No documentation found
const CAN_READ_RX0_DATA = 0x92
No documentation found
const CAN_WAKFIL_DISABLE = 0x00
No documentation found
const CAN_CLKOUT_PS4 = 0x02
No documentation found
const CAN_READ_RX1_DATA = 0x96
No documentation found
const CAN_SJW4 = 0xC0
No documentation found
const CAN_TXB1EID8 = 0x43
No documentation found
const CAN_MODE_LISTENONLY = 0x60
No documentation found
const CANINTF = 0x2C
CANINTF register and fields
const CAN_RXB1SIDH = 0x71
No documentation found
const CAN_RXF4SIDH = 0x14
RXB1 filter #4
const CAN_RXF0SIDH = 0x00
RXB0 filter #0
const CAN_RXM0SIDH = 0x20
RXB0 mask
const CAN_SAMPLE_1X = 0x00
No documentation found
const CAN_RXF3SIDH = 0x10
RXB1 filter #3
const CAN_REC = 0x1D
No documentation found
const CAN_TXB2EID0 = 0x54
No documentation found
const CAN_TXB1D1 = 0x47
No documentation found
const CAN_MODE_NORMAL = 0x00
No documentation found
const CAN_RXB1SIDL = 0x72
No documentation found
const CAN_TXB2SIDL = 0x52
No documentation found
const CAN_RXF2EID0 = 0x0B
No documentation found
const CAN_TXB0D6 = 0x3C
No documentation found
const CAN_RXF1EID8 = 0x06
No documentation found
const CAN_RXB1EID0 = 0x74
No documentation found
const CAN_RXF5SIDL = 0x19
No documentation found
const CAN_CNF2 = 0x29
CNF2 register and fields
const CAN_RXB1D7 = 0x7D
No documentation found
const CAN_TXB2SIDH = 0x51
No documentation found
const CAN_WAKIF = 0x40
No documentation found
const CAN_RXM1EID0 = 0x27
No documentation found
const CAN_TX1IE = 0x08
No documentation found
const CAN_TXB2D0 = 0x56
No documentation found
const CAN_RXF5SIDH = 0x18
RXB1 filter #5
const CANSTAT = 0x0E
other misc registers
const CAN_RXM1SIDH = 0x24
RXB1 mask
const CAN_RTS_TX2 = 0x84
No documentation found
const CAN_TXB0D2 = 0x38
No documentation found
const CAN_RXB0D2 = 0x68
No documentation found
const CAN_RXF2SIDL = 0x09
No documentation found
const CAN_TXB2D4 = 0x5A
No documentation found
const CAN_TXB2D5 = 0x5B
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_TXB0D5 = 0x3B
No documentation found
const CAN_MODE_SLEEP = 0x20
No documentation found
const CAN_RXM1SIDL = 0x25
No documentation found
const CAN_MODE_ONESHOT = 0x08
No documentation found
const CAN_RXF4SIDL = 0x15
No documentation found
const CAN_CLKOUT_PS8 = 0x03
No documentation found
const CAN_RX0IE = 0x01
No documentation found
const CAN_RXF1EID0 = 0x07
No documentation found
const CAN_RXB0SIDL = 0x62
No documentation found
const CAN_ABORT_TX = 0x10
No documentation found
const CAN_TXB2CTRL = 0x50
No documentation found
const CAN_RXF0EID8 = 0x02
No documentation found
const CAN_RXF2EID8 = 0x0A
No documentation found
const CAN_TXB1D4 = 0x4A
No documentation found
const CAN_RTS_TX0 = 0x81
No documentation found
const CAN_CLKOUT_PS2 = 0x01
No documentation found
const CAN_RXB0D4 = 0x6A
No documentation found
const CAN_TXB1D2 = 0x48
No documentation found
const CAN_TXB0DLC = 0x35
No documentation found
const CAN_RXB1EID8 = 0x73
No documentation found
const CAN_TXB1D5 = 0x4B
No documentation found
const CAN_RXB1CTRL = 0x70
No documentation found
const CAN_RXM0SIDL = 0x21
No documentation found
const CAN_MERRE = 0x80
No documentation found
const CAN_TXB2D7 = 0x5D
No documentation found
const CAN_TXB2D3 = 0x59
No documentation found
const CAN_SOF_DISABLE = 0x00
No documentation found
const CAN_RTS_TX1 = 0x82
No documentation found
const CAN_RTS_ALL = 0x87
No documentation found
const CAN_RX_STATUS_CMD = 0xB0
No documentation found
const CAN_RXF2SIDH = 0x08
RXB1 filter #2
const CAN_MERRF = 0x80
No documentation found
const CAN_LOAD_TX2 = 0x44
No documentation found
const CAN_RXB0DLC = 0x65
No documentation found
const CAN_TXB0D4 = 0x3A
No documentation found
const CAN_TX2IE = 0x10
No documentation found
const CAN_CLKOUT_ENABLE = 0x04
No documentation found
const CAN_TXB1DLC = 0x45
No documentation found
const CAN_RXB0EID0 = 0x64
No documentation found
const CAN_TX2IF = 0x10
No documentation found
const CAN_TXB1D7 = 0x4D
No documentation found
const CAN_RXF5EID8 = 0x1A
No documentation found
const CAN_RXF4EID0 = 0x17
No documentation found
const CAN_RXB0D3 = 0x69
No documentation found
const CAN_ERRIF = 0x20
No documentation found
const CAN_TXB2D1 = 0x57
No documentation found
const CAN_TXB1SIDH = 0x41
No documentation found
const CAN_MODE_POWERUP = 0xE0
No documentation found
const CAN_RXB1D3 = 0x79
No documentation found
const CAN_TXB1D0 = 0x46
No documentation found
const CAN_RXB0CTRL = 0x60
Each receive buffer has a control register, header registers, length register and (up to ) eight bytes of payload.
const CAN_RXF5EID0 = 0x1B
No documentation found
const CAN_WRITE_CMD = 0x02
MCP2515 Instructions ( SPI interface )
const CAN_TXB0D7 = 0x3D
No documentation found
const CAN_TXB0SIDH = 0x31
No documentation found
const CAN_RXF1SIDH = 0x04
RXB0 filter #1
const CAN_TXB2D2 = 0x58
No documentation found
const CAN_SOF_ENABLE = 0x80
No documentation found
const CAN_TEC = 0x1C
No documentation found
const CAN_RXF1SIDL = 0x05
No documentation found
const CAN_WAKFIL_ENABLE = 0x40
No documentation found
const CAN_TXB2EID8 = 0x53
No documentation found
const CAN_RXB1DLC = 0x75
No documentation found
const CANCTRL = 0x0F
CANCTRL register and fields
const CAN_RXB1D5 = 0x7B
No documentation found
const CAN_SAMPLE_3X = 0x40
No documentation found
const CAN_MODE_LOOPBACK = 0x40
No documentation found
const CAN_RXB0D1 = 0x67
No documentation found
const CAN_TX0IF = 0x04
No documentation found
const CAN_TX0IE = 0x04
No documentation found
const CAN_TX1IF = 0x08
No documentation found
const CAN_CNF3 = 0x28
CNF3 and fields
const CAN_TXB0D1 = 0x37
No documentation found
const CAN_RXB0D0 = 0x66
No documentation found
const CAN_RXM0EID0 = 0x23
No documentation found
const CAN_LOAD_TX1 = 0x42
No documentation found
const CAN_RXM0EID8 = 0x22
No documentation found
const CAN_RXF0EID0 = 0x03
No documentation found
const CAN_RX1IE = 0x02
No documentation found
const CAN_BITMOD = 0x05
No documentation found
const CAN_WAKIE = 0x40
No documentation found
const CAN_READ_CMD = 0x03
No documentation found
const CAN_TXB0EID8 = 0x33
No documentation found
const CAN_LOAD_TX0 = 0x40
No documentation found
const CAN_TXB1CTRL = 0x40
No documentation found
const CAN_RXB1D4 = 0x7A
No documentation found
const CAN_BTLMODE = 0x80
No documentation found
const CAN_RXF4EID8 = 0x16
No documentation found
const CAN_RXB1D6 = 0x7C
No documentation found
const CAN_RXB0D5 = 0x6B
No documentation found
const CAN_TXB1D3 = 0x49
No documentation found
const CAN_ERRIE = 0x20
No documentation found
const CAN_RXF3EID0 = 0x13
No documentation found
const CAN_RXF0SIDL = 0x01
No documentation found
const CAN_SJW2 = 0x40
No documentation found
const CAN_RXF3EID8 = 0x12
No documentation found
const CAN_RXM1EID8 = 0x26
No documentation found
const CAN_TXB1SIDL = 0x42
No documentation found
const CAN_MODE_MASK = 0xE0
No documentation found
const CAN_READ_STATUS_CMD = 0xA0
No documentation found
const CAN_MODE_CONFIG = 0x80
No documentation found
const CAN_RXB0D6 = 0x6C
No documentation found
const CAN_TXB0SIDL = 0x32
No documentation found
const CAN_RESET_CMD = 0xC0
No documentation found
const CAN_TXB1EID0 = 0x44
No documentation found
const CAN_TXB0D3 = 0x39
No documentation found
const CAN_RXB0D7 = 0x6D
No documentation found
const CAN_SJW1 = 0x00
No documentation found
const CAN_EFLG = 0x2D
No documentation found
const CANINTE = 0x2B
CANINTE register and fields
const CAN_RX1IF = 0x02
No documentation found
const CAN_SJW3 = 0x80
No documentation found
const CAN_RXB1D2 = 0x78
No documentation found
const CAN_RX0IF = 0x01
No documentation found
const CAN_CLKOUT_DISABLE = 0x00
No documentation found
const CAN_TXB0EID0 = 0x34
No documentation found
const CAN_TXB2DLC = 0x55
No documentation found
const CAN_TXB0D0 = 0x36
No documentation found
const CAN_RXF3SIDL = 0x11
No documentation found
const CAN_CLKOUT_PS1 = 0x00
No documentation found
const CAN_CNF1 = 0x2A
Bit-rate and related registers and fields. Big topic. See datasheet. CNF1 register and fields
const CAN_TXB1D6 = 0x4C
No documentation found
const CAN_TXB2D6 = 0x5C
No documentation found
const CAN_RXB1D0 = 0x76
No documentation found
const CAN_RXB0EID8 = 0x63
No documentation found
const CAN_RXB1D1 = 0x77
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 | 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
const ELEVATION = 0x0F
const SERIAL = 0x01
var word co2_global -- global CO2 value, keeps value when garbage reply
const FLAG = 0xFF
const CMD_READ = 0x02
const BRDCST = 0xFE
const CMD_UPDATE = 0x03
const CMD_STATUS = 0xB6
const CO2_PPM = 0x03
const ELEVATION = 0x0F
No documentation found
const SERIAL = 0x01
No documentation found
var word co2_global -- global CO2 value, keeps value when garbage reply
No documentation found
const FLAG = 0xFF
No documentation found
const CMD_READ = 0x02
No documentation found
const BRDCST = 0xFE
No documentation found
const CMD_UPDATE = 0x03
No documentation found
const CMD_STATUS = 0xB6
No documentation found
const CO2_PPM = 0x03
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 | 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 | 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
18f452 | 18f452_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
This lib does not create filename'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 filenames into your project.
No dependency found
var dword fat32_root_dir_first_cluster -- the location of the root dir's first cluster, should be 2
var bit fat32_is_volume_id at fat32_attrib : 3
const byte FAT32_DIRECTORY = 0
var dword fat32_file_cluster -- file's start cluster number after file_read_info()
var word fat32_dir_file_count -- number of files in current directory
var byte fat32_sectors_per_cluster -- the number of sectors per cluster, usually 8
var byte file_ext[3] -- holds file extension after file_read_info()
var bit fat32_is_read_only at fat32_attrib : 0
var bit fat32_filter_is_volume_id at fat32_attrib_filter : 3
var dword fat32_fat_begin -- the location of the file alocation table for current partition
const byte FAT32_ENTRY_IS_PART_OF_LONG_NAME = 0x0F -- entry has a few characters of a long filename
var bit fat32_is_directory at fat32_attrib : 4
var dword fat32_file_size -- holds file size after file_read_info()
var bit fat32_filter_is_archive at fat32_attrib_filter : 5
var byte fat32_attrib
var dword fat32_root_dir -- sector location of the root dir
const byte FAT32_FILE = 1
var byte fat32_attrib_filter = 0 -- default is do not filter any file attributes
var bit fat32_is_hidden at fat32_attrib : 1
var bit fat32_filter_is_system at fat32_attrib_filter : 2
const byte FAT32_ENTRY_NOT_IN_USE = 0xE5 -- usually from a deleted file
var bit fat32_filter_is_directory at fat32_attrib_filter : 4
var bit fat32_is_system at fat32_attrib : 2
var dword fat32_file_location -- holds file location after file_read_info()
var dword fat32_cluster_begin -- the location of the beginning of clusters (where files & folders data is)
var byte fat32_filename_count = 0
var dword fat32_current_dir_location -- sector location of last dir read
var bit fat32_filter_is_hidden at fat32_attrib_filter : 1
var bit fat32_is_archive at fat32_attrib : 5
var bit fat32_filter_is_read_only at fat32_attrib_filter : 0
fat32_write_entry(word in address, byte*FAT32_ENTRIES_MAX in entry_data)
fat32_create_dword(byte in val4, byte in val3, byte in val2, byte in val1, dword out result1)
fat32_read_boot_sector(byte in partition_select)
fat32_list_dir()
fat32_read_file_info(byte*FAT32_ENTRIES_MAX in file_number)
fat32_read_filename()
fat32_read_entry(word in address, byte*FAT32_ENTRIES_MAX out entry_data)
fat32_read_file(byte out in_b, byte out in_a)
fat32_init(byte in primary_partition_number)
fat32_file_open(byte in file_number) return bit
fat_32_read_filename_char() return byte
fat32_cd(byte in file_number) return bit
var dword fat32_root_dir_first_cluster -- the location of the root dir's first cluster, should be 2
No documentation found
var bit fat32_is_volume_id at fat32_attrib : 3
No documentation found
const byte FAT32_DIRECTORY = 0
read fragment locations from fat, store in fat32_dir_fragments_start & fat32_dir_fragment_cluster_count arrays
var dword fat32_file_cluster -- file's start cluster number after file_read_info()
No documentation found
var word fat32_dir_file_count -- number of files in current directory
No documentation found
var byte fat32_sectors_per_cluster -- the number of sectors per cluster, usually 8
No documentation found
var byte file_ext[3] -- holds file extension after file_read_info()
No documentation found
var bit fat32_is_read_only at fat32_attrib : 0
No documentation found
var bit fat32_filter_is_volume_id at fat32_attrib_filter : 3
No documentation found
var dword fat32_fat_begin -- the location of the file alocation table for current partition
No documentation found
const byte FAT32_ENTRY_IS_PART_OF_LONG_NAME = 0x0F -- entry has a few characters of a long filename
No documentation found
var bit fat32_is_directory at fat32_attrib : 4
No documentation found
var dword fat32_file_size -- holds file size after file_read_info()
vars you can read info from
var bit fat32_filter_is_archive at fat32_attrib_filter : 5
No documentation found
var byte fat32_attrib
Create file fat32_attribute variables
var dword fat32_root_dir -- sector location of the root dir
No documentation found
const byte FAT32_FILE = 1
No documentation found
var byte fat32_attrib_filter = 0 -- default is do not filter any file attributes
filter file attributes
var bit fat32_is_hidden at fat32_attrib : 1
No documentation found
var bit fat32_filter_is_system at fat32_attrib_filter : 2
No documentation found
const byte FAT32_ENTRY_NOT_IN_USE = 0xE5 -- usually from a deleted file
READ DIR INFO, STORE INTO ENTRY_LOCATION ARRAY refers to fat32 directory entry characters
var bit fat32_filter_is_directory at fat32_attrib_filter : 4
No documentation found
var bit fat32_is_system at fat32_attrib : 2
No documentation found
var dword fat32_file_location -- holds file location after file_read_info()
No documentation found
var dword fat32_cluster_begin -- the location of the beginning of clusters (where files & folders data is)
No documentation found
var byte fat32_filename_count = 0
No documentation found
var dword fat32_current_dir_location -- sector location of last dir read
No documentation found
var bit fat32_filter_is_hidden at fat32_attrib_filter : 1
No documentation found
var bit fat32_is_archive at fat32_attrib : 5
No documentation found
var bit fat32_filter_is_read_only at fat32_attrib_filter : 0
No documentation found
fat32_write_entry(word in address, byte*FAT32_ENTRIES_MAX in entry_data)
these procedures may get removed.
fat32_create_dword(byte in val4, byte in val3, byte in val2, byte in val1, dword out result1)
creates a dword from 4 bytes old procedure, needs to be fixed or removed
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_list_dir()
requires serial connection to your pc, you may modify this for your own application requires: include format.jal, serial_hw.jal
fat32_read_file_info(byte*FAT32_ENTRIES_MAX in file_number)
reads file info such as filename, filesize, filelocation, etc. into memory.
fat32_read_filename()
send the current filename via serial port, you may modify this for your own application. requires serial_hw.jal
fat32_read_entry(word in address, byte*FAT32_ENTRIES_MAX out entry_data)
No documentation found
fat32_read_file(byte out in_b, byte out in_a)
read data from the currently opened file.
fat32_init(byte in primary_partition_number)
initalize fat32
_fat32_send_dword(dword in dval1)
Send dword via serial port (for troubleshooting only)
fat32_file_open(byte in file_number) return bit
No documentation found
fat_32_read_filename_char() return byte
No documentation found
fat32_cd(byte in file_number) return bit
change directory, returns 1 = success, 0 = not a directory
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 byte _format_sign
No documentation found
var byte _format_digit
No documentation found
var bit _format_signed = false
No documentation found
var byte _format_leader
global vars
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 fontlookup[] =
No documentation found
const byte var_nmb = 5 -- holds number of bytes used for a char
No documentation found
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 var_nmb = 6 -- holds number of bytes used for a char
No documentation found
const byte fontlookup[] =
No documentation found
Author | Stef Mientki, Serkan Ayyýldýz Copyright (c) 2006..2009, all rights reserved. |
Adapted-by | Joep Suijs |
Compiler | >=2.2 |
Generic routines for graphic lcd. glcd_box glcd_line And mapping to char based lcd: lcd_put lcd_...
No dependency found
lcd_box(byte in x0, byte in y0, byte in x1, byte in y1)
lcd'put(byte in char)
lcd_setcursor(byte in row, byte in col)
lcd_clearscreen()
lcd_home()
lcd_line(byte in x0, byte in y0, byte in x1, byte in y1)
var byte glcd_char_x_pos = 0;
No documentation found
var byte glcd_char_y_pos = 0;
No documentation found
lcd_box(byte in x0, byte in y0, byte in x1, byte in y1)
lcd'put(byte in char)
Pseudo variable 'lcd' as alternative for lcd_writechar()
lcd_setcursor(byte in row, byte in col)
Set cursor position Specify row and column in base-0 notation (first line is 0).
lcd_clearscreen()
Clear screen (and set the cursor to the upper left corner: row 0, column 0)
lcd_home()
cursor returns home(line 1, position 1)
lcd_line(byte in x0, byte in y0, byte in x1, byte in y1)
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 KS0108_CMD_TOP_RAM = 0xC0
const KS0108_CMD_ON = 0x3F
const KS0108_CMD_PAGE = 0xB8
const KS0108_LEFT = 0
const KS0108_CMD_OFF = 0x3E
const KS0108_RIGHT = 1
const byte _font_5x7_table[] = {
const KS0108_CMD_COLUMN = 0x40
lcd_write_char(byte in x, byte in y, byte in ch )
ks0108_write_byte(byte in x, byte in y, byte in veri)
lcd_init()
lcd_on()
lcd_write_pixel(byte in x, byte in y, bit in onoff)
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 KS0108_CMD_TOP_RAM = 0xC0
No documentation found
const KS0108_CMD_ON = 0x3F
No documentation found
const KS0108_CMD_PAGE = 0xB8
No documentation found
const KS0108_LEFT = 0
No documentation found
const KS0108_CMD_OFF = 0x3E
No documentation found
const KS0108_RIGHT = 1
No documentation found
const byte _font_5x7_table[] = {
_font_5x7_table[] - character table 91 * 5 bytes = 455
const KS0108_CMD_COLUMN = 0x40
No documentation found
lcd_write_char(byte in x, byte in y, byte in ch )
lcd_write_char - Writes an inverted character to the display 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)
lcd_init()
lcd_init - Initialize the graphic LCD. Call before using any other LCD function.
lcd_on()
Purpose: Turn the display on
lcd_write_pixel(byte in x, byte in y, bit in onoff)
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 3) color - ON or OFF
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
Author | Andre Miller Copyright (c) 2008..2010, all rights reserved. |
Adapted-by | Richard Zengerink |
Compiler | >=2.4n |
library for Nokia 3310 display with pcd8544 controller
http://www.amontec.com/lcd_nokia_3310.shtml
print_char_i(byte in letter)
lcd_gotoxy(byte in xnokia, byte in ynokia)
char_string_to_nokia( byte in str[])
lcd_init()
print_char(byte in letter)
lcd_clear_screen()
lcd'put(byte in data)
graphic_to_nokia( byte in graph[])
print_char_i(byte in letter)
Writes an inverted character to the display
lcd_gotoxy(byte in xnokia, byte in ynokia)
Set the current position for data (x = 0->83, y = 0->5)
char_string_to_nokia( byte in str[])
No documentation found
lcd_init()
Send LCD Initialization
print_char(byte in letter)
Writes a character to the display
lcd_clear_screen()
No documentation found
lcd'put(byte in data)
lcd'put - write one char to screen (pseudo var, enables streams)
graphic_to_nokia( byte in graph[])
No documentation found
_lcd_write(byte in value)
No documentation found
_lcd_write_command(byte in value)
Write a command byte to the LCD
_lcd_write_data(byte in value)
Write a data byte to the LCD
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_1mhz = (target_clock / (4 * 1000_000)) - 1
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
No documentation found
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
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 |
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_buffer[I2C_BUFFER_SIZE]
var bit i2c_datapresent -- datapresent flag
const bit i2c_enable_start_stop_interrupts = true
var byte i2c_index -- i2c index (pointer)
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_buffer[I2C_BUFFER_SIZE]
No documentation found
var bit i2c_datapresent -- datapresent flag
No documentation found
const bit i2c_enable_start_stop_interrupts = true
No documentation found
var byte i2c_index -- i2c index (pointer)
vars
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_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!)
i2c_transmit_byte( byte in x ) return bit
i2c_transmit_byte - output one byte
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_VT = 11
const byte ASCII_NAK = 21
const byte ASCII_EOT = 04
const byte ASCII_GS = 29
const byte ASCII_CAN = 24
const byte ASCII_DC2 = 18
const byte ASCII_SOH = 01
const byte ASCII_SO = 14
const byte ASCII_US = 31
const byte ASCII_SI = 15
const byte ASCII_BEL = 07
const byte ASCII_EM = 25
const byte ASCII_RS = 30
const byte ASCII_CR = 13
const byte ASCII_DC3 = 19
const byte ASCII_ENQ = 05
const byte ASCII_FS = 28
const byte ASCII_DEL = 127
const byte ASCII_STX = 02
const byte ASCII_DLE = 16
const byte ASCII_ACK = 06
const byte ASCII_HT = 09
const byte ASCII_LF = 10
const byte ASCII_DC4 = 20
const byte ASCII_ESC = 27
const byte ASCII_SUB = 26
const byte ASCII_FF = 12
const byte ASCII_ETB = 23
const byte ASCII_DC1 = 17
const byte ASCII_SP = 32
const byte ASCII_SYN = 22
const byte ASCII_ETX = 03
const byte ASCII_BS = 08
const byte ASCII_NULL = 00
const byte ASCII_VT = 11
No documentation found
const byte ASCII_NAK = 21
No documentation found
const byte ASCII_EOT = 04
No documentation found
const byte ASCII_GS = 29
No documentation found
const byte ASCII_CAN = 24
No documentation found
const byte ASCII_DC2 = 18
No documentation found
const byte ASCII_SOH = 01
No documentation found
const byte ASCII_SO = 14
No documentation found
const byte ASCII_US = 31
No documentation found
const byte ASCII_SI = 15
No documentation found
const byte ASCII_BEL = 07
No documentation found
const byte ASCII_EM = 25
No documentation found
const byte ASCII_RS = 30
No documentation found
const byte ASCII_CR = 13
No documentation found
const byte ASCII_DC3 = 19
No documentation found
const byte ASCII_ENQ = 05
No documentation found
const byte ASCII_FS = 28
No documentation found
const byte ASCII_DEL = 127
No documentation found
const byte ASCII_STX = 02
No documentation found
const byte ASCII_DLE = 16
No documentation found
const byte ASCII_ACK = 06
No documentation found
const byte ASCII_HT = 09
No documentation found
const byte ASCII_LF = 10
No documentation found
const byte ASCII_DC4 = 20
No documentation found
const byte ASCII_ESC = 27
No documentation found
const byte ASCII_SUB = 26
No documentation found
const byte ASCII_FF = 12
No documentation found
const byte ASCII_ETB = 23
No documentation found
const byte ASCII_DC1 = 17
No documentation found
const byte ASCII_SP = 32
No documentation found
const byte ASCII_SYN = 22
No documentation found
const byte ASCII_ETX = 03
No documentation found
const byte ASCII_BS = 08
No documentation found
const byte ASCII_NULL = 00
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 lastkey = 0xff
No documentation found
var byte scan0, scan1, scan2, scan3
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_rtc_hardware.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 |
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 in 10 usec units = 30uS
const lcd_long_delay = 120 -- delay in 10 usec units = 1,2mS
const lcd_normal_delay = 3 -- delay in 10 usec units = 30uS
delay's necessary for initialisation and some commands
const lcd_long_delay = 120 -- delay in 10 usec units = 1,2mS
No documentation found
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 in 10 usec units = 30uS
const lcd_long_delay = 120 -- delay in 10 usec units = 1,2mS
const lcd_normal_delay = 3 -- delay in 10 usec units = 30uS
delay's necessary for initialisation and some commands
const lcd_long_delay = 120 -- delay in 10 usec units = 1,2mS
No documentation found
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 in 10 usec units = 30uS
const lcd_long_delay = 120 -- delay in 10 usec units = 1,2mS
const lcd_normal_delay = 3 -- delay in 10 usec units = 30uS
delay's necessary for initialisation and some commands
const lcd_long_delay = 120 -- delay in 10 usec units = 1,2mS
No documentation found
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_TA = 0x0040 ; ta indication
const DSM_2 = 0x0400 ; channel 2 indication
const DSM_OO = 0x8000 ; stereo indication
const DSM_RDS = 0x0002 ; rds indicator
const DSM_1 = 0x0100 ; channel 1 indication
const DSM_4 = 0x0800 ; channel 4 indication
const DSM_I1 = 0x1000 ; left signal indication
const DSM_TP = 0x0020 ; tp indication
const DSM_FM = 0x4000 ; fm indication
const DSM_3 = 0x0200 ; channel 3 indication
const byte dsm_tab[] =
var word dsm_indicator_cache = 0
const DSM_I3 = 0x0004 ; right signal indication
const DSM_6 = 0x2000 ; channel 6 indication
const DSM_DOT = 0x0010 ; decimal point
const DSM_I2 = 0x0001 ; central signal indication
var byte dsm_pos = 0
const DSM_5 = 0x8000 ; channel 5 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_TA = 0x0040 ; ta indication
No documentation found
const DSM_2 = 0x0400 ; channel 2 indication
No documentation found
const DSM_OO = 0x8000 ; stereo indication
No documentation found
const DSM_RDS = 0x0002 ; rds indicator
No documentation found
const DSM_1 = 0x0100 ; channel 1 indication
No documentation found
const DSM_4 = 0x0800 ; channel 4 indication
No documentation found
const DSM_I1 = 0x1000 ; left signal indication
No documentation found
const DSM_TP = 0x0020 ; tp indication
No documentation found
const DSM_FM = 0x4000 ; fm indication
No documentation found
const DSM_3 = 0x0200 ; channel 3 indication
No documentation found
const byte dsm_tab[] =
Translation table of ascci to two bytes, which indicate which segment have to be switched on.
var word dsm_indicator_cache = 0
No documentation found
const DSM_I3 = 0x0004 ; right signal indication
No documentation found
const DSM_6 = 0x2000 ; channel 6 indication
No documentation found
const DSM_DOT = 0x0010 ; decimal point
No documentation found
const DSM_I2 = 0x0001 ; central signal indication
No documentation found
var byte dsm_pos = 0
No documentation found
const DSM_5 = 0x8000 ; channel 5 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.4g |
Nibble interface for HD44780 compatible alphanumeric LCD screens. . Expects: - 2 pins for handshake: 'lcd_rs' and 'lcd_en' and - 1 port nibble for data: 'lcd_dataport' or - 4 lines for data: 'lcd_d4' .. 'lcd_d7' note: a 'port nibble' - the lower or higher 4 bits of a port - give faster and more compact code then random selected data lines. . 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 lcd_en is pin_A4 -- trigger var bit lcd_rs is pin_A5 -- cmd/data select and variables (aliases): var byte lcd_dataport is portA_low -- 4 data pins or var bit lcd_d4 is pin_A3 -- databit d4 pin var bit lcd_d5 is pin_A1 -- databit d5 pin var bit lcd_d6 is pin_C0 -- databit d6 pin var bit lcd_d7 is pin_C2 -- databit d7 pin . 2. Set the chosen LCD dataport and handshake pins to output: pin_A4_direction = output pin_A5_direction = output and portA_low_direction = all_output or pin_A3_direction = output -- set data pin as output pin_A1_direction = output -- set data pin as output pin_C0_direction = output -- set data pin as output pin_C2_direction = output -- set data pin as 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( byte in value )
_lcd_write_command(byte in value)
_lcd_write_data(byte in value)
lcd_init()
Initialize LCD controller to 4-bit mode
lcd_debug_hardware_interface(byte in speed)
Pulse interface lines in sequence d0 .. d3, en, rs. Use an oscilloscope (speed = 1) or leds (speed = 200) to check signal. Note: procedure contains 'forever loop', so never returns.
__lcd_write_nibble( byte in value )
Sends low nibble into 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 into LCD (this procedure is only used inside this library)
_lcd_write_command(byte in value)
Sends command byte into LCD For slow commands an extra delay should be added
_lcd_write_data(byte in value)
Sends data byte into LCD
Author | Rob Hamerling, Copyright (c) 2008..2009, all rights reserved. |
Adapted-by | Eur van Andel, Joep Suijs (refactoring),Richard Zengerink (lcd_init) |
Compiler | >=2.4g |
Port interface for HD44780 compatible alphanumeric LCD screens. Uses 8 bit wide datapath + 2 handshake lines (total 10 PIC pins). Expects: - 2 pins for handshake: 'lcd_rs' and 'lcd_en' - 1 complete port for data: 'lcd_dataport' or - 2 pins for handshake: 'lcd_rs' and 'lcd_en' - 8 lines for data: 'lcd_d0' .. 'lcd_d7' note: a 'port nibble' - the lower or higher 4 bits of a port - give faster and more compact code then random selected data lines. . 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 lcd_rs is pin_D2 -- cmd/data select var bit lcd_en is pin_D3 -- trigger and variables (aliases): var byte lcd_dataport is portF -- 8 data pins or var byte lcd_dataport_low is portD_high -- 4 low order data pins var byte lcd_dataport_high is portC_high -- 4 high order data pins or var bit lcd_d0 is pin_D0 -- databit d0 pin var bit lcd_d1 is pin_D1 -- databit d1 pin var bit lcd_d2 is pin_C6 -- databit d2 pin var bit lcd_d3 is pin_C7 -- databit d3 pin var bit lcd_d4 is pin_B0 -- databit d4 pin var bit lcd_d5 is pin_B1 -- databit d5 pin var bit lcd_d6 is pin_C0 -- databit d6 pin var bit lcd_d7 is pin_C2 -- databit d7 pin . 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 half data ports to output: portD_high_direction = ALL_OUTPUT portC_high_direction = ALL_OUTPUT or 8 individual pins to outout pin_D0_direction = output -- set data pin as output pin_D1_direction = output -- set data pin as output pin_C6_direction = output -- set data pin as output pin_C7_direction = output -- set data pin as output pin_B0_direction = output -- set data pin as output pin_B1_direction = output -- set data pin as output pin_C0_direction = output -- set data pin as output pin_C2_direction = output -- set data pin as 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()
Initialise the LCD controller and API
_lcd_write_data(byte in value)
Sends data byte into LCD
__lcd_write( byte in value )
Sends byte into the LCD (this procedure is only used inside this file).
_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..2009, all rights reserved. |
Adapted-by | Joep Suijs, |
Compiler | >=2.4j |
Common API for HD44780 based LCD . Procedures which can be used by application program: . * lcd_write_char( byte in value ): writes 'value' to lcd example: lcd_write_char( "E" ) or lcd_write_char( 69 ) . * lcd = value: writes 'value' to lcd example: lcd = "E" or lcd = 69 . * lcd_cursor_position(byte in line, byte in pos): places the cursor on position (pos) in line (line) (zero based!) example: lcd_new_line_cursor_position (1, 8) . * lcd_shift_left(byte in value): shifts the display [value] times to the left without changing DDRAM data. example: lcd_shift_left(4) or lcd_shift_left(variable) . * lcd_shift_right(byte in value): shifts the display [value] times to the right without changing DDRAM data. example: lcd_shift_right(12) or lcd_shift_right(variable) . * lcd_cursor_shift_left(byte in value): shifts the cursor [value] times to the left without changing display contents and DDRAM data. example: lcd_cursor_shift_left(8) or lcd_cursor_shift_left(variable) . * lcd_cursor_shift_right(byte in value): shifts the cursor [value] times to the right without changing display contents and DDRAM data. example: lcd_cursor_shift_right(3) or lcd_cursor_shift_right(variable) . * lcd_clear: Write "20H" to DDRAM and set DDRAM address to "00H" from AC This will clear the display. . * lcd_home: Set DDRAM address to "00H" from AC and return cursor to its original position if shifted. The contents of DDRAM are not changed. . * lcd_cursor_blink_display(bit in cursor,bit in blink,bit in display): sets the underline cursor on/off, let the block-cursor blinking/off and puts the display on/off example: lcd_cursor_blink_display(on,off,on) . * lcd_clear_line ( byte in line ) clears the line [line] of the lcd including DDRAM data of that line example: lcd_clear_line(1) . * lcd_progress(byte in line, byte in amount) create a progress bar on line [line] with a lenght of [amout] example: lcd_progress(2,12)
No dependency found
const LCD_DISPLAY_SHIFT_RIGHT = 0b_0001_1100
const LCD_CURSOR_SHIFT_R_VAL = 0b_0001_0100
const LCD_DISPLAY_SHIFT_LEFT = 0b_0001_1000
const LCD_CLEAR_DISPLAY = 0b_0000_0001
const LCD_RETURN_HOME = 0b_0000_0010
const LCD_SET_DDRAM_ADDRESS = 0b_1000_0000
const LCD_SET_CGRAM_ADDRESS = 0b_0100_0000
const LCD_DISPLAY_ONOFF = 0b_0000_1000
var volatile byte lcd_pos = 0
const LCD_CURSOR_SHIFT_L_VAL = 0b_0001_0000
lcd_clear_screen()
lcd_clear_line(byte in line)
lcd_shift_right(byte in nr)
lcd_writechar(byte in data)
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_RIGHT = 0b_0001_1100
No documentation found
const LCD_CURSOR_SHIFT_R_VAL = 0b_0001_0100
No documentation found
const LCD_DISPLAY_SHIFT_LEFT = 0b_0001_1000
No documentation found
const LCD_CLEAR_DISPLAY = 0b_0000_0001
some constants to control the lcd
const LCD_RETURN_HOME = 0b_0000_0010
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_DISPLAY_ONOFF = 0b_0000_1000
No documentation found
var volatile byte lcd_pos = 0
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_shift_right(byte in nr)
lcd_shift_right - shifts the complete display one position to the right
lcd_writechar(byte in data)
Deprecated
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)
_hd44780_init()
_hd44780_init - Initialise display (not realy internal, but not for users) This procedure is called from lcd_init of the interface used. lcd_init brings up the interface and powers up the display. This procedure sets the display in the pre-defined startposition (clear screen, no cursor etc).
_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.
const serial_sw_baudrate = 57600
var bit lcd_rs_shadow
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
__lcd_write_nibble( byte in value )
__lcd_write( byte in value )
_lcd_write_command(byte in value)
_lcd_write_data(byte in value)
const serial_sw_baudrate = 57600
No documentation found
var bit lcd_rs_shadow
No documentation found
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
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
No documentation found
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_BASS_ENHANCE = 0x7C -- base enhance register
var byte sta015_left = 0 -- current left speaker volume
const byte _STA015_TREBLE_ENHANCE = 0x7B -- treble enhance register
const byte STA015_STOP_PLAY = 102 -- Tell device to stop playing. Or just stop sending data
const byte STA015_STEREO = 0 -- stereo
var byte _sta015_head_mid -- holds some mp3 info
const byte _STA015_RESET = 0x16 -- soft reset command register
const byte STA015_TREBLE_UP = 110 -- Turn up the treble (high frequency sounds)
const byte _STA015_DRB = 0x49 -- right volume register
const byte _STA015_TONE_ATTEN = 0x7D -- tone attenuation register
const byte STA015_SINGLE_CHANNEL = 3 -- single_channel (mono)
var byte _sta015_head_low -- holds some mp3 info
const byte STA015_VOLUME_DOWN = 105 -- Turn down the volume (more attenuation)
const byte STA015_DUAL_CHANNEL = 2 -- dual_channel
var byte sta015_crystal -- holds the crystal value chosen after init
var word sta015_bitrate
const byte _STA015_DRA = 0x48 -- left volume register
var byte sta015_mode -- holds the current mode, byte value from 0 to 3
const byte STA015_JOINT_STEREO = 1 -- joint stereo (intensity_stereo and/or ms_stereo)
const byte STA015_MUTE = 103 -- Mute (turn off volume but continue playing)
const byte _STA015_RUN = 0x72 -- run command register
const byte STA015_TREBLE_DOWN = 109 -- Turn down treble (high frequency sounds)
const byte STA015_BASE_UP = 108 -- Turn up base (low frequency sounds)
var sbyte sta015_base = 0 -- current base volume
const byte STA015_START_PLAY = 101 -- Tell the device to start playing. You need to send data after
const byte STA015_VOLUME_UP = 106 -- Turn up the volume (less attenuation)
const byte _STA015_MUTE = 0x14 -- mute command register
const byte STA015_NO_MUTE = 104 -- Turn off Mute (restore volume)
const byte STA015_LEFT_DOWN = 113 -- Turn down the left speaker volume
const byte STA015_READ_INFO = 115 -- Get mp3 bitrate and mode(mono/stereo) with sta015_read_mp3_info() command
const byte STA015_OSC_14_31818 = 2 -- 14.31818 mhz crystal
const byte _STA015_PLAY = 0x19 -- play command register
const byte STA015_BASE_DOWN = 107 -- Turn down base (low frequency sounds)
const byte STA015_LEFT_UP = 114 -- Turn up the left speaker volume
var byte sta015_right = 0 -- current right speaker volume
const byte STA015_RESET = 100 -- Reset the sta015 device
var byte sta015_attenuation = STA015_DEFAULT_ATTENUATION -- current attenuation / volume
var sbyte sta015_treble = 0 -- current treble volume
const byte STA015_OSC_14_7456 = 3 -- 14.7456 mhz crystal
const byte STA015_RIGHT_DOWN = 111 -- Turn down the right speaker volume
const byte STA015_RIGHT_UP = 112 -- Turn up the right speaker volume
var byte _sta015_head_high -- holds some mp3 info
const byte STA015_OSC_10 = 0 -- 10 mhz crystal
const byte STA015_OSC_20 = 1 -- 20 mhz crystal
sta015_read_mp3_info()
sta015_send(byte in data)
sta015_init(byte in crystal_speed)
sta015_send_volume()
sta015_read_register(byte in reg_address, byte out data)
sta015_write_command(byte in command)
sta015_write_register(byte in reg_address, byte in data)
const byte _STA015_BASS_ENHANCE = 0x7C -- base enhance register
No documentation found
var byte sta015_left = 0 -- current left speaker volume
No documentation found
const byte _STA015_TREBLE_ENHANCE = 0x7B -- treble enhance register
No documentation found
const byte STA015_STOP_PLAY = 102 -- Tell device to stop playing. Or just stop sending data
No documentation found
const byte STA015_STEREO = 0 -- stereo
No documentation found
var byte _sta015_head_mid -- holds some mp3 info
No documentation found
const byte _STA015_RESET = 0x16 -- soft reset command register
register addresses
const byte STA015_TREBLE_UP = 110 -- Turn up the treble (high frequency sounds)
No documentation found
const byte _STA015_DRB = 0x49 -- right volume register
No documentation found
const byte _STA015_TONE_ATTEN = 0x7D -- tone attenuation register
No documentation found
const byte STA015_SINGLE_CHANNEL = 3 -- single_channel (mono)
No documentation found
var byte _sta015_head_low -- holds some mp3 info
No documentation found
const byte STA015_VOLUME_DOWN = 105 -- Turn down the volume (more attenuation)
No documentation found
const byte STA015_DUAL_CHANNEL = 2 -- dual_channel
No documentation found
var byte sta015_crystal -- holds the crystal value chosen after init
No documentation found
var word sta015_bitrate
holds current playing mp3's bitrate or quality in kbps after sta015_write_command(STA015_READ_INFO)
const byte _STA015_DRA = 0x48 -- left volume register
No documentation found
var byte sta015_mode -- holds the current mode, byte value from 0 to 3
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_JOINT_STEREO = 1 -- joint stereo (intensity_stereo and/or ms_stereo)
No documentation found
const byte STA015_MUTE = 103 -- Mute (turn off volume but continue playing)
No documentation found
const byte _STA015_RUN = 0x72 -- run command register
No documentation found
const byte STA015_TREBLE_DOWN = 109 -- Turn down treble (high frequency sounds)
No documentation found
const byte STA015_BASE_UP = 108 -- Turn up base (low frequency sounds)
No documentation found
var sbyte sta015_base = 0 -- current base volume
No documentation found
const byte STA015_START_PLAY = 101 -- Tell the device to start playing. You need to send data after
No documentation found
const byte STA015_VOLUME_UP = 106 -- Turn up the volume (less attenuation)
No documentation found
const byte _STA015_MUTE = 0x14 -- mute command register
No documentation found
const byte STA015_NO_MUTE = 104 -- Turn off Mute (restore volume)
No documentation found
const byte STA015_LEFT_DOWN = 113 -- Turn down the left speaker volume
No documentation found
const byte STA015_READ_INFO = 115 -- Get mp3 bitrate and mode(mono/stereo) with sta015_read_mp3_info() command
No documentation found
const byte STA015_OSC_14_31818 = 2 -- 14.31818 mhz crystal
No documentation found
const byte _STA015_PLAY = 0x19 -- play command register
No documentation found
const byte STA015_BASE_DOWN = 107 -- Turn down base (low frequency sounds)
No documentation found
const byte STA015_LEFT_UP = 114 -- Turn up the left speaker volume
No documentation found
var byte sta015_right = 0 -- current right speaker volume
No documentation found
const byte STA015_RESET = 100 -- Reset the sta015 device
send one of the following constants to the sta015_write_command procedure
var byte sta015_attenuation = STA015_DEFAULT_ATTENUATION -- current attenuation / volume
volume control vars, read only. use sta015_write_command() procedure to change volume
var sbyte sta015_treble = 0 -- current treble volume
No documentation found
const byte STA015_OSC_14_7456 = 3 -- 14.7456 mhz crystal
No documentation found
const byte STA015_RIGHT_DOWN = 111 -- Turn down the right speaker volume
No documentation found
const byte STA015_RIGHT_UP = 112 -- Turn up the right speaker volume
No documentation found
var byte _sta015_head_high -- holds some mp3 info
No documentation found
const byte STA015_OSC_10 = 0 -- 10 mhz crystal
oscillators for the init procedure
const byte STA015_OSC_20 = 1 -- 20 mhz crystal
No documentation found
sta015_read_mp3_info()
No documentation found
sta015_send(byte in data)
No documentation found
sta015_init(byte in crystal_speed)
No documentation found
sta015_send_volume()
No documentation found
sta015_read_register(byte in reg_address, byte out 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
18f452 | 18f452_mp3_decoder_sta015_sd_card.jal |
18f452 | 18f452_mp3_decoder_sta015_pata_hard_disk.jal |
18f4620 | 18f4620_mp3_decoder_sta015_pata_hard_disk.jal |
18f4620 | 18f4620_mp3_decoder_sta015_sd_card.jal |
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_gpio1_data at vs_port_gpio_data : 1
var bit vs_pin_gpio0_data at vs_port_gpio_data : 0
var bit vs_pin_gpio6_data at vs_port_gpio_data : 6
const byte VS_REG_AICTRL3 = 0x0F
var sbyte _vs_current_volume_right = 0
var dword vs_average_bitrate -- actual average speed of incomming data
var sbyte vs_current_treble = 0
var byte _vs_current_volume = 0
const byte VS_REG_WRAM = 0x06
var bit vs_pin_gpio5_direction_data at vs_port_gpio_direction_data : 5
const byte VS_REG_HDAT0 = 0x08
var bit vs_pin_gpio4_direction_data at vs_port_gpio_direction_data : 4
const byte VS_REG_STATUS = 0x01
var bit vs_pin_gpio1_direction_data at vs_port_gpio_direction_data : 1
const byte _vs_table_layer2_id3[15] = {0,32,48,56,64,80,96,112,128,160,192,224,256,320,384}
const byte VS_REG_CLOCKF = 0x03
const byte _vs_table_layer3_id3[15] = {0,32,40,48,56,64,80,96,112,128,160,192,224,256,320}
const byte _vs_table_layer1_id3[15] = {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448}
var sbyte _vs_current_volume_left = 0
var bit vs_pin_gpio6_direction_data at vs_port_gpio_direction_data : 6
const word _vs_samplerate_id2[3] = {16000,24000,22050}
var byte _vs_play_speed_data = 1
const byte _vs_table_layer1_id[15] = {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256}
var bit vs_pin_gpio3_direction_data at vs_port_gpio_direction_data : 3
const byte VS_REG_BASS = 0x02
var byte vs_port_gpio_direction_data = 0
const word _vs_samplerate_id3[3] = {32000,48000,44100}
var bit vs_pin_gpio5_data at vs_port_gpio_data : 5
var bit vs_init_ok = FALSE
var bit vs_pin_gpio0_direction_data at vs_port_gpio_direction_data : 0
var bit _vs_mute_data = FALSE
var byte _vs_right_data at _vs_volume_data_both[1]
var byte _vs_left_data at _vs_volume_data_both[0]
const byte VS_REG_AICTRL2 = 0x0E
var bit vs_pin_gpio4_data at vs_port_gpio_data : 4
const byte VS_REG_WRAMADDR = 0x07
var bit vs_pin_gpio7_data at vs_port_gpio_data : 7
const byte VS_REG_AICTRL0 = 0x0C
var bit vs_pin_gpio2_direction_data at vs_port_gpio_direction_data : 2
const word _vs_samplerate_id1[3] = {8000,12000,11025}
const byte VS_REG_HDAT1 = 0x09
var word vs_samplerate -- sample rate (for .mp3 only)
var dword vs_bitrate -- bitrate specified in the file's data
var bit vs_pin_gpio7_direction_data at vs_port_gpio_direction_data : 7
const byte VS_REG_AIADDR = 0x0A
var byte vs_current_bass = 0
var byte*2 _vs_volume_data= 0
const byte VS_REG_VOL = 0x0B
var byte _vs_volume_data_both[2] at _vs_volume_data
var bit vs_pin_gpio3_data at vs_port_gpio_data : 3
const byte _vs_table_layer3_id[15] = {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}
var bit vs_pin_gpio2_data at vs_port_gpio_data : 2
const byte VS_REG_DECODE_TIME = 0x04
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_AUDATA = 0x05
var byte vs_port_gpio_data = 0
const byte VS_REG_MODE = 0x00
const byte VS_REG_AICTRL1 = 0x0D
var byte vs_current_file_type[4] -- holds current file type after vs_file_info()
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_gpio1_data at vs_port_gpio_data : 1
No documentation found
var bit vs_pin_gpio0_data at vs_port_gpio_data : 0
No documentation found
var bit vs_pin_gpio6_data at vs_port_gpio_data : 6
No documentation found
const byte VS_REG_AICTRL3 = 0x0F
No documentation found
var sbyte _vs_current_volume_right = 0
No documentation found
var dword vs_average_bitrate -- actual average speed of incomming data
No documentation found
var sbyte vs_current_treble = 0
No documentation found
var byte _vs_current_volume = 0
No documentation found
const byte VS_REG_WRAM = 0x06
No documentation found
var bit vs_pin_gpio5_direction_data at vs_port_gpio_direction_data : 5
No documentation found
const byte VS_REG_HDAT0 = 0x08
No documentation found
var bit vs_pin_gpio4_direction_data at vs_port_gpio_direction_data : 4
No documentation found
const byte VS_REG_STATUS = 0x01
No documentation found
var bit vs_pin_gpio1_direction_data at vs_port_gpio_direction_data : 1
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
const byte VS_REG_CLOCKF = 0x03
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
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
var sbyte _vs_current_volume_left = 0
No documentation found
var bit vs_pin_gpio6_direction_data at vs_port_gpio_direction_data : 6
No documentation found
const word _vs_samplerate_id2[3] = {16000,24000,22050}
No documentation found
var byte _vs_play_speed_data = 1
data variables for internal use only
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
var bit vs_pin_gpio3_direction_data at vs_port_gpio_direction_data : 3
No documentation found
const byte VS_REG_BASS = 0x02
No documentation found
var byte vs_port_gpio_direction_data = 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
var bit vs_pin_gpio5_data at vs_port_gpio_data : 5
No documentation found
var bit vs_init_ok = FALSE
if initialization was ok, this will change to TRUE
var bit vs_pin_gpio0_direction_data at vs_port_gpio_direction_data : 0
No documentation found
var bit _vs_mute_data = FALSE
No documentation found
var byte _vs_right_data at _vs_volume_data_both[1]
No documentation found
var byte _vs_left_data at _vs_volume_data_both[0]
No documentation found
const byte VS_REG_AICTRL2 = 0x0E
No documentation found
var bit vs_pin_gpio4_data at vs_port_gpio_data : 4
No documentation found
const byte VS_REG_WRAMADDR = 0x07
No documentation found
var bit vs_pin_gpio7_data at vs_port_gpio_data : 7
No documentation found
const byte VS_REG_AICTRL0 = 0x0C
No documentation found
var bit vs_pin_gpio2_direction_data at vs_port_gpio_direction_data : 2
No documentation found
const word _vs_samplerate_id1[3] = {8000,12000,11025}
No documentation found
const byte VS_REG_HDAT1 = 0x09
No documentation found
var word vs_samplerate -- sample rate (for .mp3 only)
No documentation found
var dword vs_bitrate -- bitrate specified in the file's data
you can read these variables after calling vs_file_info()
var bit vs_pin_gpio7_direction_data at vs_port_gpio_direction_data : 7
No documentation found
const byte VS_REG_AIADDR = 0x0A
No documentation found
var byte vs_current_bass = 0
No documentation found
var byte*2 _vs_volume_data= 0
No documentation found
const byte VS_REG_VOL = 0x0B
No documentation found
var byte _vs_volume_data_both[2] at _vs_volume_data
No documentation found
var bit vs_pin_gpio3_data at vs_port_gpio_data : 3
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
var bit vs_pin_gpio2_data at vs_port_gpio_data : 2
No documentation found
const byte VS_REG_DECODE_TIME = 0x04
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_AUDATA = 0x05
No documentation found
var byte vs_port_gpio_data = 0
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_AICTRL1 = 0x0D
No documentation found
var byte vs_current_file_type[4] -- holds current file type after vs_file_info()
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
18f4620 | 18f4620_mp3_decoder_vs1053b_pata_hard_disk.jal |
18f4620 | 18f4620_mp3_decoder_vs1053b_sd_card.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
const PATA_HD_PRECOMP_REG = 9 -- write precomp reg
const PATA_HD_COMMAND_REG = 15 -- command register
const PATA_HD_SPIN_DOWN = 0xE0 -- turn off the drive's motor
const dword LARGE_ARRAY_3_SIZE = 512 -- choose number of array variables
const PATA_HD_SEC_COUNT_REG = 10 -- sector count
const PATA_HD_STATUS_REG = 15 -- status register (creates interupt)
const bit PATA_HD_WAIT_READ = 0 -- wait for sector buffer to fill it's contents with data from disk platters
const PATA_HD_CYL_HIGH_REG = 13 -- cylinder high
var byte pata_hd_sector_count = 0 -- counds sectors read, must be a byte.
const bit PATA_HD_WAIT_WRITE = 1 -- wait for sector buffer to empty it's contents to disk platters
const PATA_HD_RECALIBRATE = 0x10 -- sends drive heads to cyl 0, SC, SN, and SDH are not changed
const PATA_HD_CYL_LOW_REG = 12 -- cylinder low
const PATA_HD_DODC_REG = 16 -- digital output / device control
const PATA_HD_WRITE_SECTORS = 0x30 -- write data to sector(s)
const SD_CARD = 1
const PATA_HD_SEC_NUM_REG = 11 -- sector number
const PATA_HD_ALT_STATUS_REG = 16 -- alternate status (no interupt)
var dword pata_hd_sector_select = 0
const PATA_HD_ADDRESS_REG = 17 -- drive address
const PATA_HARD_DISK = 0 -- data media constants for fat32 lib
const PATA_HD_SDH_REG = 14 -- sector/drive/head register
const PATA_HD_IDENTIFY_DRIVE = 0xEC -- read drive info such as make/modem/sn/drive size
const dword LARGE_ARRAY_3_VARIABLE_SIZE = 1 -- choose size of variables
const DATA_MEDIA = PATA_HARD_DISK
var byte pata_hd_word_count = 0 -- counts words read from current sector, must be a byte
const PATA_HD_READ_SECTORS = 0x20 -- reads data from sector(s)
var bit pata_hd_48_bit_lba_support = false -- currently this lib does not support drives > 137,438,952,960 bytes (28 bit addressing)
const PATA_HD_SPIN_UP = 0xE1 -- turn on the drive's motor
const PATA_HD_ERROR_REG = 9 -- error register
const PATA_HD_DATA_REG = 8 -- data register
pata_hd_start_write(dword in address)
pata_hd_write_pulse( byte in z )
pata_hd_data_request(bit in read_write)
pata_hd_go_to_sector(dword in sector, byte in sec_count)
pata_hd_read_data(byte out low_byte, byte out high_byte)
pata_hd_read_sector()
pata_hd_read_pulse(dword in z)
pata_hd_register_read(byte in register, byte out low_byte)
pata_hd_select_register(byte in register)
pata_hd_write_to_sector_end(byte in input_byte)
pata_hd_init()
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_drive_ready()
pata_hd_register_write(byte in register, byte in low_byte)
pata_hd_start_read(dword in address)
pata_hd_write_data(byte in low_byte, byte in high_byte)
pata_hd_busy()
pata_hd_stop_read()
const PATA_HD_PRECOMP_REG = 9 -- write precomp reg
writeable registers
const PATA_HD_COMMAND_REG = 15 -- command register
No documentation found
const PATA_HD_SPIN_DOWN = 0xE0 -- turn off the drive's motor
No documentation found
const dword LARGE_ARRAY_3_SIZE = 512 -- choose number of array variables
No documentation found
const PATA_HD_SEC_COUNT_REG = 10 -- sector count
No documentation found
const PATA_HD_STATUS_REG = 15 -- status register (creates interupt)
No documentation found
const bit PATA_HD_WAIT_READ = 0 -- wait for sector buffer to fill it's contents with data from disk platters
other constants used for pata_hd_data_request()
const PATA_HD_CYL_HIGH_REG = 13 -- cylinder high
No documentation found
var byte pata_hd_sector_count = 0 -- counds sectors read, must be a byte.
No documentation found
const bit PATA_HD_WAIT_WRITE = 1 -- wait for sector buffer to empty it's contents to disk platters
No documentation found
const PATA_HD_RECALIBRATE = 0x10 -- sends drive heads to cyl 0, SC, SN, and SDH are not changed
common commands for command register:
const PATA_HD_CYL_LOW_REG = 12 -- cylinder low
No documentation found
const PATA_HD_DODC_REG = 16 -- digital output / device control
No documentation found
const PATA_HD_WRITE_SECTORS = 0x30 -- write data to sector(s)
No documentation found
const SD_CARD = 1
No documentation found
const PATA_HD_SEC_NUM_REG = 11 -- sector number
No documentation found
const PATA_HD_ALT_STATUS_REG = 16 -- alternate status (no interupt)
No documentation found
var dword pata_hd_sector_select = 0
other vars
const PATA_HD_ADDRESS_REG = 17 -- drive address
No documentation found
const PATA_HARD_DISK = 0 -- data media constants for fat32 lib
No documentation found
const PATA_HD_SDH_REG = 14 -- sector/drive/head register
No documentation found
const PATA_HD_IDENTIFY_DRIVE = 0xEC -- read drive info such as make/modem/sn/drive size
No documentation found
const dword LARGE_ARRAY_3_VARIABLE_SIZE = 1 -- choose size of variables
No documentation found
const DATA_MEDIA = PATA_HARD_DISK
No documentation found
var byte pata_hd_word_count = 0 -- counts words read from current sector, must be a byte
variables
const PATA_HD_READ_SECTORS = 0x20 -- reads data from sector(s)
No documentation found
var bit pata_hd_48_bit_lba_support = false -- currently this lib does not support drives > 137,438,952,960 bytes (28 bit addressing)
No documentation found
const PATA_HD_SPIN_UP = 0xE1 -- turn on the drive's motor
No documentation found
const PATA_HD_ERROR_REG = 9 -- error register
readable registers
const PATA_HD_DATA_REG = 8 -- data register
readable/writeable registers
pata_hd_start_write(dword in address)
Get drive ready for writing at specified address
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_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_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_read_data(byte out low_byte, byte out high_byte)
Read two bytes from disk.
pata_hd_read_sector()
No documentation found
pata_hd_read_pulse(dword in z)
Send a number of read pulses to data register without getting any 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_register_read(byte in register, byte out low_byte)
Select a register and get data from it.
pata_hd_select_register(byte in register)
Set register select pins to selected register, for internal use only.
pata_hd_write_to_sector_end(byte in input_byte)
Finnish writing the current sector with input byte.
pata_hd_init()
initialize startup settings
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_drive_ready()
Wait for drive to be up to speed and ready for a command.
pata_hd_register_write(byte in register, byte in low_byte)
Select a register and give it a command or data.
pata_hd_start_read(dword in address)
Get drive ready for reading at specified address
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_busy()
Registers may not be accessed unless bsy bit is low due to internal operations.
pata_hd_stop_read()
Tell drive you are done reading
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 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_total_duty_cycle -- position in total duty cycle
var byte ps_on_period = 0
var byte div8, mod8
var byte ps_counter -- 1..32 ISR period counter
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_total_duty_cycle -- position in total duty cycle
No documentation found
var byte ps_on_period = 0
No documentation found
var byte div8, mod8
No documentation found
var byte ps_counter -- 1..32 ISR period counter
No documentation found
RTC()
No documentation found
ps_check_period()
No documentation found
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_remember_me.jal |
16f88 | 16f88_data_eeprom.jal |
18f14k50 | 18f14k50_data_eeprom.jal |
18f242 | 18f242_data_eeprom.jal |
18f2620 | 18f2620_data_eeprom.jal |
18f452 | 18f452_mp3_decoder_sta015_pata_hard_disk.jal |
18f452 | 18f452_fat32_pata_hard_disk.jal |
18f452 | 18f452_mp3_decoder_sta015_sd_card.jal |
18f452 | 18f452_fat32_sd_card.jal |
18f4550 | 18f4550_data_eeprom.jal |
18f4620 | 18f4620_mp3_decoder_vs1053b_pata_hard_disk.jal |
18f4620 | 18f4620_mp3_decoder_sta015_pata_hard_disk.jal |
18f4620 | 18f4620_mp3_decoder_vs1053b_sd_card.jal |
18f4620 | 18f4620_mp3_decoder_sta015_sd_card.jal |
18f4620 | 18f4620_fat32_sd_card.jal |
18f4620 | 18f4620_fat32_pata_hard_disk.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 | 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
print_word_dec(volatile byte out device, word in data)
print_byte_binary(volatile byte out device, byte in data)
print_dword_dec(volatile byte out device, dword 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_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_bit_truefalse(volatile byte out device, bit in data)
_print_universal_dec(volatile byte out device, dword in data, sdword in digit_divisor, byte in digit_number)
_print_suniversal_dec(volatile byte out device, sdword in data, sdword in digit_divisor, byte in digit_number)
const byte nibble2hex[] = "0123456789ABCDEF" -- conversion string
No documentation found
var bit print_prefix = false
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_dword_dec(volatile byte out device, dword 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_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_bit_truefalse(volatile byte out device, bit in data)
No documentation found
_print_universal_dec(volatile byte out device, dword in data, sdword in digit_divisor, byte in digit_number)
No documentation found
_print_suniversal_dec(volatile byte out device, sdword in data, sdword in digit_divisor, byte in digit_number)
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*2 _ccp1con_shadow_dc1b at _ccp1con_shadow : 4 -- 2 LSbits of duty cycle
var byte _ccpr1l_shadow = 0 -- 8 MSbits of duty cycle
var bit*4 _ccp1con_shadow_ccp1m at _ccp1con_shadow : 0 -- mode pattern
var byte _ccp1con_shadow = 0b0000_0000 -- shadow
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*2 _ccp1con_shadow_dc1b at _ccp1con_shadow : 4 -- 2 LSbits of duty cycle
No documentation found
var byte _ccpr1l_shadow = 0 -- 8 MSbits of duty cycle
No documentation found
var bit*4 _ccp1con_shadow_ccp1m at _ccp1con_shadow : 0 -- mode pattern
No documentation found
var byte _ccp1con_shadow = 0b0000_0000 -- shadow
No documentation found
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 byte _ccpr10l_shadow = 0 -- 8 MSbits of duty cycle
var bit*4 _ccp10con_shadow_ccp10m at _ccp10con_shadow : 0 -- mode pattern
var bit*2 _ccp10con_shadow_dc10b at _ccp10con_shadow : 4 -- 2 LSbits of duty cycle
var byte _ccp10con_shadow = 0b0000_0000 -- shadow
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 byte _ccpr10l_shadow = 0 -- 8 MSbits of duty cycle
No documentation found
var bit*4 _ccp10con_shadow_ccp10m at _ccp10con_shadow : 0 -- mode pattern
No documentation found
var bit*2 _ccp10con_shadow_dc10b at _ccp10con_shadow : 4 -- 2 LSbits of duty cycle
No documentation found
var byte _ccp10con_shadow = 0b0000_0000 -- shadow
No documentation found
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 bit*4 _ccp2con_shadow_ccp2m at _ccp2con_shadow : 0 -- mode pattern
var bit*2 _ccp2con_shadow_dc2b at _ccp2con_shadow : 4 -- 2 LSbits of duty cycle
var byte _ccp2con_shadow = 0b0000_0000 -- shadow
var byte _ccpr2l_shadow = 0 -- 8 MSbits of duty cycle
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 bit*4 _ccp2con_shadow_ccp2m at _ccp2con_shadow : 0 -- mode pattern
No documentation found
var bit*2 _ccp2con_shadow_dc2b at _ccp2con_shadow : 4 -- 2 LSbits of duty cycle
No documentation found
var byte _ccp2con_shadow = 0b0000_0000 -- shadow
No documentation found
var byte _ccpr2l_shadow = 0 -- 8 MSbits of duty cycle
No documentation found
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*4 _ccp3con_shadow_ccp3m at _ccp3con_shadow : 0 -- mode pattern
var bit*2 _ccp3con_shadow_dc3b at _ccp3con_shadow : 4 -- 2 LSbits of duty cycle
var byte _ccpr3l_shadow = 0 -- 8 MSbits of duty cycle
var byte _ccp3con_shadow = 0b0000_0000 -- shadow
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*4 _ccp3con_shadow_ccp3m at _ccp3con_shadow : 0 -- mode pattern
No documentation found
var bit*2 _ccp3con_shadow_dc3b at _ccp3con_shadow : 4 -- 2 LSbits of duty cycle
No documentation found
var byte _ccpr3l_shadow = 0 -- 8 MSbits of duty cycle
No documentation found
var byte _ccp3con_shadow = 0b0000_0000 -- shadow
No documentation found
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 byte _ccp4con_shadow = 0b0000_0000 -- shadow
var bit*2 _ccp4con_shadow_dc4b at _ccp4con_shadow : 4 -- 2 LSbits of duty cycle
var byte _ccpr4l_shadow = 0 -- 8 MSbits of duty cycle
var bit*4 _ccp4con_shadow_ccp4m at _ccp4con_shadow : 0 -- mode pattern
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 byte _ccp4con_shadow = 0b0000_0000 -- shadow
No documentation found
var bit*2 _ccp4con_shadow_dc4b at _ccp4con_shadow : 4 -- 2 LSbits of duty cycle
No documentation found
var byte _ccpr4l_shadow = 0 -- 8 MSbits of duty cycle
No documentation found
var bit*4 _ccp4con_shadow_ccp4m at _ccp4con_shadow : 0 -- mode pattern
No documentation found
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 _ccp5con_shadow = 0b0000_0000 -- shadow
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 bit*4 _ccp5con_shadow_ccp5m at _ccp5con_shadow : 0 -- mode pattern
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 _ccp5con_shadow = 0b0000_0000 -- shadow
No documentation found
var byte _ccpr5l_shadow = 0 -- 8 MSbits of duty cycle
No documentation found
var bit*2 _ccp5con_shadow_dc5b at _ccp5con_shadow : 4 -- 2 LSbits of duty cycle
No documentation found
var bit*4 _ccp5con_shadow_ccp5m at _ccp5con_shadow : 0 -- mode pattern
No documentation found
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 byte _ccp6con_shadow = 0b0000_0000 -- shadow
var bit*4 _ccp6con_shadow_ccp6m at _ccp6con_shadow : 0 -- mode pattern
var bit*2 _ccp6con_shadow_dc6b at _ccp6con_shadow : 4 -- 2 LSbits of duty cycle
var byte _ccpr6l_shadow = 0 -- 8 MSbits of duty cycle
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 byte _ccp6con_shadow = 0b0000_0000 -- shadow
No documentation found
var bit*4 _ccp6con_shadow_ccp6m at _ccp6con_shadow : 0 -- mode pattern
No documentation found
var bit*2 _ccp6con_shadow_dc6b at _ccp6con_shadow : 4 -- 2 LSbits of duty cycle
No documentation found
var byte _ccpr6l_shadow = 0 -- 8 MSbits of duty cycle
No documentation found
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 byte _ccp7con_shadow = 0b0000_0000 -- shadow
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
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 byte _ccp7con_shadow = 0b0000_0000 -- shadow
No documentation found
var bit*4 _ccp7con_shadow_ccp7m at _ccp7con_shadow : 0 -- mode pattern
No documentation found
var bit*2 _ccp7con_shadow_dc7b at _ccp7con_shadow : 4 -- 2 LSbits of duty cycle
No documentation found
var byte _ccpr7l_shadow = 0 -- 8 MSbits of duty cycle
No documentation found
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 bit*4 _ccp8con_shadow_ccp8m at _ccp8con_shadow : 0 -- mode pattern
var byte _ccpr8l_shadow = 0 -- 8 MSbits of duty cycle
var byte _ccp8con_shadow = 0b0000_0000 -- shadow
var bit*2 _ccp8con_shadow_dc8b at _ccp8con_shadow : 4 -- 2 LSbits of duty cycle
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 bit*4 _ccp8con_shadow_ccp8m at _ccp8con_shadow : 0 -- mode pattern
No documentation found
var byte _ccpr8l_shadow = 0 -- 8 MSbits of duty cycle
No documentation found
var byte _ccp8con_shadow = 0b0000_0000 -- shadow
No documentation found
var bit*2 _ccp8con_shadow_dc8b at _ccp8con_shadow : 4 -- 2 LSbits of duty cycle
No documentation found
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*2 _ccp9con_shadow_dc9b at _ccp9con_shadow : 4 -- 2 LSbits of duty cycle
var bit*4 _ccp9con_shadow_ccp9m at _ccp9con_shadow : 0 -- mode pattern
var byte _ccp9con_shadow = 0b0000_0000 -- shadow
var byte _ccpr9l_shadow = 0 -- 8 MSbits of duty cycle
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*2 _ccp9con_shadow_dc9b at _ccp9con_shadow : 4 -- 2 LSbits of duty cycle
No documentation found
var bit*4 _ccp9con_shadow_ccp9m at _ccp9con_shadow : 0 -- mode pattern
No documentation found
var byte _ccp9con_shadow = 0b0000_0000 -- shadow
No documentation found
var byte _ccpr9l_shadow = 0 -- 8 MSbits of duty cycle
No documentation found
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 -- value(PR2) + 1
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.
12f683 | 12f683_pwm_adc.jal |
16f648a | 16f648a_pwm_led.jal |
16f648a | 16f648a_pwm_led_highres.jal |
16f648a | 16f648a_pwm_sound.jal |
16f723 | 16f723_pwm_led.jal |
16f723 | 16f723_pwm_sound.jal |
16f723 | 16f723_pwm_led_highres.jal |
16f73 | 16f73_pwm_led_highres.jal |
16f73 | 16f73_pwm_led.jal |
16f73 | 16f73_pwm_sound.jal |
16f73 | 16f73_pwm2.jal |
16f767 | 16f767_pwm_adc.jal |
16f877 | 16f877_pwm_led.jal |
16f877 | 16f877_pwm_sound.jal |
16f877 | 16f877_pwm2.jal |
16f877 | 16f877_pwm_led_highres.jal |
16f877a | 16f877a_pwm_led_highres.jal |
16f877a | 16f877a_pwm_led.jal |
16f877a | 16f877a_pwm_sound.jal |
16f877a | 16f877a_pwm2.jal |
16f88 | 16f88_ir_ranger_gp2d02.jal |
16f88 | 16f88_pwm_sound.jal |
16f88 | 16f88_pwm_led_highres.jal |
16f88 | 16f88_pwm_led.jal |
16f886 | 16f886_pwm_adc_freq.jal |
16f886 | 16f886_pwm_adc_res.jal |
18f14k50 | 18f14k50_pwm_sound.jal |
18f14k50 | 18f14k50_pwm_led.jal |
18f14k50 | 18f14k50_pwm_led_highres.jal |
18f2450 | 18f2450_pwm_led_highres.jal |
18f2450 | 18f2450_pwm_sound.jal |
18f2450 | 18f2450_pwm_led.jal |
18f4550 | 18f4550_pwm_led_highres.jal |
18f4550 | 18f4550_pwm_sound.jal |
18f4550 | 18f4550_pwm_led.jal |
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
No dependency found
var volatile byte queue01_in_pointer = 0 ; wijst naar vrije locatie
var volatile byte queue01_data[queue01_size + 1]
var volatile byte queue01_out_pointer = 0 ; wijst naar databyte
queue01'get() return byte
queue01_empty() return bit
queue01_is_empty() return bit
queue01_nr_free() return byte
queue01_nr_used() return byte
queue01_is_full() return bit
queue01_nb_put(byte in v) return bit
queue01_nb'get() return byte
queue01_nb_get(byte out v) return bit
var volatile byte queue01_in_pointer = 0 ; wijst naar vrije locatie
No documentation found
var volatile byte queue01_data[queue01_size + 1]
queue vars
var volatile byte queue01_out_pointer = 0 ; wijst naar databyte
No documentation found
queue01_nb'put(byte in v)
queue01_nb'put - put one byte into queue (non-blocking)
queue01'put(byte 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'get() return byte
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.
queue01_empty() return bit
queue01_is_empty() return bit
queue01_is_empty() -- returns true if queue is emtpy
queue01_nr_free() return byte
queue01_nr_free - returns nr of free places in queue
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_nb_put(byte 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_nb'get - get one byte from queue (non-blocking) returns byte from queue, 0 if queue empty
queue01_nb_get(byte 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)
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_in_pointer = 0 ; wijst naar vrije locatie
var volatile byte queue02_out_pointer = 0 ; wijst naar databyte
var volatile byte queue02_data[queue02_size + 1]
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_in_pointer = 0 ; wijst naar vrije locatie
No documentation found
var volatile byte queue02_out_pointer = 0 ; wijst naar databyte
No documentation found
var volatile byte queue02_data[queue02_size + 1]
queue vars
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_out_pointer = 0 ; wijst naar databyte
var volatile byte queue03_data[queue03_size + 1]
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_out_pointer = 0 ; wijst naar databyte
No documentation found
var volatile byte queue03_data[queue03_size + 1]
queue vars
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_out_pointer = 0 ; wijst naar databyte
var volatile byte queue04_data[queue04_size + 1]
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_out_pointer = 0 ; wijst naar databyte
No documentation found
var volatile byte queue04_data[queue04_size + 1]
queue vars
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_data[queue05_size + 1]
var volatile byte queue05_in_pointer = 0 ; wijst naar vrije locatie
var volatile byte queue05_out_pointer = 0 ; wijst naar databyte
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_data[queue05_size + 1]
queue vars
var volatile byte queue05_in_pointer = 0 ; wijst naar vrije locatie
No documentation found
var volatile byte queue05_out_pointer = 0 ; wijst naar databyte
No documentation found
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_out_pointer = 0 ; wijst naar databyte
var volatile byte queue06_in_pointer = 0 ; wijst naar vrije locatie
var volatile byte queue06_data[queue06_size + 1]
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_out_pointer = 0 ; wijst naar databyte
No documentation found
var volatile byte queue06_in_pointer = 0 ; wijst naar vrije locatie
No documentation found
var volatile byte queue06_data[queue06_size + 1]
queue vars
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_in_pointer = 0 ; wijst naar vrije locatie
var volatile byte queue07_out_pointer = 0 ; wijst naar databyte
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_in_pointer = 0 ; wijst naar vrije locatie
No documentation found
var volatile byte queue07_out_pointer = 0 ; wijst naar databyte
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_data[queue08_size + 1]
var volatile byte queue08_in_pointer = 0 ; wijst naar vrije locatie
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_data[queue08_size + 1]
queue vars
var volatile byte queue08_in_pointer = 0 ; wijst naar vrije locatie
No documentation found
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 _rndx 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 byte nr
No documentation found
var volatile dword _rndx = 2282008
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_random.jal |
16f877a | 16f877a_random.jal |
16f88 | 16f88_random.jal |
18f14k50 | 18f14k50_random.jal |
18f2450 | 18f2450_random.jal |
18f452 | 18f452_mp3_decoder_sta015_pata_hard_disk.jal |
18f452 | 18f452_mp3_decoder_sta015_sd_card.jal |
18f4550 | 18f4550_random.jal |
18f4620 | 18f4620_mp3_decoder_sta015_sd_card.jal |
18f4620 | 18f4620_mp3_decoder_sta015_pata_hard_disk.jal |
Author | Rob Hamerling, Copyright (c) 2010..2010, 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: - rtc_init() -- initialize rtc module and library - rtc_calibrate() -- compensate crystal frequency aberration - rtc_pin_signal() -- RTCC output pin signal control - rtc_get_hhmm_bcd() -- obtain hours,minute (bcd format) - rtc_get_hhmm_bin() -- obtain relative minute of day (binary) - rtc_get_hhmmss_bcd() -- obtain hours,minutes,seconds (bcd format) - rtc_get_hhmmss_bin() -- obtain relative second of day (binary) - rtc_set_hhmmss_bcd() -- set new hours,minutes,seconds (bcd format) - rtc_get_yymmdd_bcd() -- get year,month,day (bcd format) - rtc_set_yymmdd_bcd() -- set new year,month,day (bcd format) - rtc_get_weekday() -- get day of week number (binary) - rtc_get_alarm_hhmmss_bcd() -- get alarm time (bcd format) - rtc_set_alarm_hhmmss_bcd() -- set alarm time (bcd format) - rtc_set_alarm_period() -- set alarm period - rtc_set_alarm_repeat() -- set alarm repeat - rtc_set_alarm() -- enable/disable alarm . Additional general purpose functions and procedures: - bcd2bin() -- convert byte from bcd to binary - mult60() -- hours -> minutes, minutes -> seconds . Several procedures and functions use multi-byte variables to pass arguments in bcd-notation. This is done in high-to-low sequence. To access the individual bytes of such a 'composite' variable you could use the data overlay facility of the compiler. For example for the date in years, months and days you could declare a variable as: . var byte*3 yymmdd_bcd -- date (bcd) . and in addition: . var byte yymmdd[3] at yymmdd_bcd -- overlay as array var byte yy at yymmdd[0] -- ) var byte mm at yymmdd[1] -- ) overlay as bytes var byte dd at yymmdd[2] -- ) . Now you can access the year-byte of 'yymmdd_bcd' simply with 'yy' (contents still in bcd notation!), and month and day similarly. . PICs use little endian notation (store multi-byte variables with low order byte first)! So when you want to set the date to 10:07:28 you must specify: rtc_set_yymmdd(0x280710) -- 'reversed' sequence! . Bytes in bcd-notation can easily be displayed with print_byte_hex() of the Jallib print library.
No dependency found
var byte _alrm_weekday = 0x00 -- day of week
var byte _alrm_month = 0x01 -- month
var byte _alrm_monthday = 0x00 -- day of month
var byte _rtc_year = 0x00 -- year
var byte _rtc_min = 0x00 -- minute
var byte _alrm_hour = 0x00 -- hour
var byte _rtc_monthday = 0x01 -- day of month
var byte _rtc_sec = 0x00 -- second
var byte _alrm_sec = 0x00 -- second
var byte _alrm_min = 0x00 -- minute
var byte _rtc_month = 0x01 -- month
var byte _rtc_hour = 0x12 -- hour
var byte _rtc_weekday = 0x00 -- day of week
rtc_calibrate(sbyte in calibration)
rtc_set_alarm_repeat(byte in alarm_repeat)
rtc_set_yymmdd_bcd(byte*3 in yymmdd_bcd)
rtc_set_alarm(bit in alarm_state)
rtc_init()
rtc_set_alarm_hhmmss_bcd(byte*3 in hhmmss_bcd)
rtc_set_alarm_signal(bit in alarm_signal)
rtc_set_hhmmss_bcd(byte*3 in hhmmss_bcd)
rtc_set_alarm_period(byte in alarm_period)
rtc_pin_signal(bit*2 in pin_signal_selection_mask)
mult60(word in x) return dword
rtc_get_hhmmss_bcd() return byte*3
rtc_get_hhmm_bin() return word
rtc_get_weekday() return byte
rtc_get_hhmm_bcd() return word
rtc_get_hhmmss_bin() return dword
rtc_get_alarm_hhmmss_bcd() return byte*3
rtc_get_yymmdd_bcd() return byte*3
bcd2bin(byte in bcd) return byte
var byte _alrm_weekday = 0x00 -- day of week
No documentation found
var byte _alrm_month = 0x01 -- month
No documentation found
var byte _alrm_monthday = 0x00 -- day of month
No documentation found
var byte _rtc_year = 0x00 -- year
No documentation found
var byte _rtc_min = 0x00 -- minute
No documentation found
var byte _alrm_hour = 0x00 -- hour
No documentation found
var byte _rtc_monthday = 0x01 -- day of month
No documentation found
var byte _rtc_sec = 0x00 -- second
No documentation found
var byte _alrm_sec = 0x00 -- second
No documentation found
var byte _alrm_min = 0x00 -- minute
No documentation found
var byte _rtc_month = 0x01 -- month
No documentation found
var byte _rtc_hour = 0x12 -- hour
No documentation found
var byte _rtc_weekday = 0x00 -- day of week
No documentation found
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_repeat(byte in alarm_repeat)
Set alarm repetition factor. input: alarm_repeat (byte): number of times to repeat alarm signal output: none returns: nothing
rtc_set_yymmdd_bcd(byte*3 in yymmdd_bcd)
Set date (yymmdd) in BCD format. input: year,month,day-of-month in bcd format (byte*3) output: none returns: nothing notes: - Expected range: yy 0..99, mm 1..12, dd 1..31 in bcd notation - RTC hardware does not calculate weekday from date, so we have to do it here. We use the algorithm by Tomohiko Sakamoto of Sony, slightly squeezed to support 21st century only (2000..2099).
rtc_set_alarm(bit in alarm_state)
Enable or disable alarm. input: alarm_state (bit): true - alarm active false - alarm not active output: none returns: nothing
rtc_init()
Initialize the RTCC module. input: none output: none returns: nothing notes:
rtc_set_alarm_hhmmss_bcd(byte*3 in hhmmss_bcd)
Set alarm time in bcd format. input: hour-minute-second in bcd format output: none returns: nothing
rtc_set_alarm_signal(bit in alarm_signal)
Set alarm signal. input: alarm_signal (bit): true - alarm signal activated false - alarm signal deactivated output: none returns: nothing
rtc_set_hhmmss_bcd(byte*3 in hhmmss_bcd)
Set time of day (hhmmss) in BCD format. input: year,month,day-of-month in bcd format (byte*3) output: none returns: nothing
rtc_set_alarm_period(byte in alarm_period)
Set alarm period. input: alarm_period with a RTC_ALARM_PERIOD_xxxx mask (see the defined RTC_ALARM_PERIOD_xxxx masks above) output: none returns: nothing
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_read()
Read the realtime clock. input: none output: none returns: nothing notes: copy RTC registers to 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 generates the correct sequences with the code below.
_rtc_alrm_read()
Read the alarm setting. input: none output: none returns: nothing notes: copy RTC alarm registers to local variables
_rtc_write()
Write the realtime clock. input: none output: none returns: nothing notes: - enable writing to RTC registers - update RTC - disable writes
_rtc_alrm_write()
Write te alarm time of realtime clock. input: none output: none returns: nothing notes: - disable alarm - copy RTC alarm registers to 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_hhmmss_bcd() return byte*3
Get time of day (hhmmss) in BCD format. input: none output: none returns: hhmmss in bcd format (byte*3)
rtc_get_hhmm_bin() return word
Get relative minute of day in binary format input: none output: none returns: minute of day binary (word)
rtc_get_weekday() return byte
Get weekday number in binary format. input: none output: none returns: day of week number (0..6)
rtc_get_hhmm_bcd() return word
Get time of day (hhmm) in BCD format. input: none output: none returns: hhmm in bcd format (word)
rtc_get_hhmmss_bin() return dword
Get relative second of day in binary format input: none output: none returns: second of day binary (dword)
rtc_get_alarm_hhmmss_bcd() return byte*3
Get alarm time of day in BCD format. input: none output: none returns: alarm time setting (hhmmss) in bcd format
rtc_get_yymmdd_bcd() return byte*3
Get date (yymmdd) in BCD format. input: none output: none returns: yymmdd in bcd format
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!).
18f26j11 | 18f26j11_rtc_hardware.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
var volatile byte _rtc_bres_mid = _rtc_mid -- > init 3-byte counter
const byte _rtc_mid = _rtc_cycles_per_second % 65536 / 256
const byte _rtc_hi = _rtc_cycles_per_second / 65536
var volatile byte _rtc_bres_hi = _rtc_hi -- \
var volatile byte _rtc_bres_lo = _rtc_lo -- /
const _rtc_cycles_per_second = (target_clock / 4)
var volatile byte seconds -- global variable updated by ISR
const byte _rtc_lo = _rtc_cycles_per_second % 256
var volatile byte _rtc_bres_mid = _rtc_mid -- > init 3-byte counter
No documentation found
const byte _rtc_mid = _rtc_cycles_per_second % 65536 / 256
No documentation found
const byte _rtc_hi = _rtc_cycles_per_second / 65536
No documentation found
var volatile byte _rtc_bres_hi = _rtc_hi -- \
No documentation found
var volatile byte _rtc_bres_lo = _rtc_lo -- /
No documentation found
const _rtc_cycles_per_second = (target_clock / 4)
No documentation found
var volatile byte seconds -- global variable updated by ISR
No documentation found
const byte _rtc_lo = _rtc_cycles_per_second % 256
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. Original assembler by Roman Black. . 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
const _rtc_cycles_per_second = (target_clock / 4)
var volatile dword _rtc_bresenham = _rtc_cycles_per_second
var volatile byte seconds -- global variable updated by ISR
const _rtc_cycles_per_second = (target_clock / 4)
No documentation found
var volatile dword _rtc_bresenham = _rtc_cycles_per_second
No documentation found
var volatile byte seconds -- global variable updated by ISR
No documentation found
RTC()
No documentation found
18f2620 | 18f2620_rtc_tmr3.jal |
Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4l |
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
This version works with only standard capacity sd cards up to 4gb, high capacity up to 32 gb, and Extended Capacity up to 2TB may be supported later on.
const byte SD_SEND_NUM_WR_BLOCKS = 22
const byte SD_PROGRAM_CSD = 27
const dword LARGE_ARRAY_4_SIZE = 512 -- choose number of array variables
const byte SD_STOP_TRANSMISSION = 12
const byte SD_WRITE_MULTIPLE_BLOCK = 25
const byte SD_SEND_SCR = 51
const byte SD_CLR_WRITE_PROT = 29
const byte SD_APP_CMD = 55 -- indicate that the next command is a application specific command
const byte SD_GO_IDLE_STATE = 0
const byte SD_SET_BLOCKLEN = 16
const byte SD_SET_WR_BLK_ERASE_COUNT = 23
const byte SD_SD_STATUS = 13
const byte SD_READ_SINGLE_BLOCK = 17
const byte SD_SEND_OP_COND = 1
const PATA_HARD_DISK = 0
const byte SD_SEND_CID = 10
const byte SD_GEN_CMD = 56
const byte SD_SEND_WRITE_PROT = 30
const byte SD_ERASE_WR_BLK_END = 33
var word sd_sector_count = 0
const byte SD_READ_MULTIPLE_BLOCK = 18
const byte SD_ERASE_WR_BLK_START = 32
const SD_CARD = 1
const byte SD_ERASE = 38
const byte SD_SD_APP_OP_COND = 41
const byte SD_WRITE_BLOCK = 24
var byte sd_word_count = 0
const byte SD_CRC_ON_OFF = 59 -- default is off
const byte SD_SET_WRITE_PROT = 28
const dword LARGE_ARRAY_4_VARIABLE_SIZE = 1 -- choose size of variables
const byte SD_READ_OCR = 58
const DATA_MEDIA = SD_CARD
const byte SD_SEND_STATUS = 13
const byte SD_SEND_CSD = 9 -- sd sends "Card Specific Data" standard or high capacity
const byte SD_SET_CLR_CARD_DETECT = 42
sd_ready()
sd_write_to_sector_end(byte in input_byte)
sd_init()
sd_stop_read()
sd_write_pulse(byte in count1)
send_command(byte in command,dword in data, byte out response)
sd_read_sector()
sd_read_data(byte out low_byte, byte out high_byte)
sd_stop_write()
sd_set_idle()
sd_read_pulse(byte in count1)
sd_start_read(dword in address)
sd_start_write(dword in address)
sd_write_data(byte in low_byte, byte in high_byte)
const byte SD_SEND_NUM_WR_BLOCKS = 22
No documentation found
const byte SD_PROGRAM_CSD = 27
No documentation found
const dword LARGE_ARRAY_4_SIZE = 512 -- choose number of array variables
No documentation found
const byte SD_STOP_TRANSMISSION = 12
No documentation found
const byte SD_WRITE_MULTIPLE_BLOCK = 25
No documentation found
const byte SD_SEND_SCR = 51
No documentation found
const byte SD_CLR_WRITE_PROT = 29
No documentation found
const byte SD_APP_CMD = 55 -- indicate that the next command is a application specific command
Application Specific Commands
const byte SD_GO_IDLE_STATE = 0
Basic Commands
const byte SD_SET_BLOCKLEN = 16
Read Commands
const byte SD_SET_WR_BLK_ERASE_COUNT = 23
No documentation found
const byte SD_SD_STATUS = 13
application specific command, must write command 55 first
const byte SD_READ_SINGLE_BLOCK = 17
No documentation found
const byte SD_SEND_OP_COND = 1
No documentation found
const PATA_HARD_DISK = 0
constants for fat32 library
const byte SD_SEND_CID = 10
No documentation found
const byte SD_GEN_CMD = 56
No documentation found
const byte SD_SEND_WRITE_PROT = 30
No documentation found
const byte SD_ERASE_WR_BLK_END = 33
No documentation found
var word sd_sector_count = 0
No documentation found
const byte SD_READ_MULTIPLE_BLOCK = 18
No documentation found
const byte SD_ERASE_WR_BLK_START = 32
Erase Commands
const SD_CARD = 1
No documentation found
const byte SD_ERASE = 38
No documentation found
const byte SD_SD_APP_OP_COND = 41
No documentation found
const byte SD_WRITE_BLOCK = 24
Write Commands
var byte sd_word_count = 0
counters
const byte SD_CRC_ON_OFF = 59 -- default is off
No documentation found
const byte SD_SET_WRITE_PROT = 28
Write Protection Commands
const dword LARGE_ARRAY_4_VARIABLE_SIZE = 1 -- choose size of variables
No documentation found
const byte SD_READ_OCR = 58
Other Commands
const DATA_MEDIA = SD_CARD
No documentation found
const byte SD_SEND_STATUS = 13
No documentation found
const byte SD_SEND_CSD = 9 -- sd sends "Card Specific Data" standard or high capacity
No documentation found
const byte SD_SET_CLR_CARD_DETECT = 42
No documentation found
sd_ready()
No documentation found
sd_write_to_sector_end(byte in input_byte)
No documentation found
sd_init()
No documentation found
sd_stop_read()
No documentation found
sd_write_pulse(byte in count1)
No documentation found
send_command(byte in command,dword in data, byte out response)
No documentation found
sd_read_sector()
No documentation found
sd_read_data(byte out low_byte, byte out high_byte)
No documentation found
sd_stop_write()
No documentation found
sd_set_idle()
No documentation found
sd_read_pulse(byte in count1)
No documentation found
sd_start_read(dword in address)
No documentation found
sd_start_write(dword in address)
No documentation found
sd_write_data(byte in low_byte, byte in high_byte)
No documentation found
16f877a | 16f877a_sd_card.jal |
18f452 | 18f452_mp3_decoder_sta015_sd_card.jal |
18f452 | 18f452_sd_card.jal |
18f452 | 18f452_fat32_sd_card.jal |
18f4620 | 18f4620_mp3_decoder_vs1053b_sd_card.jal |
18f4620 | 18f4620_mp3_decoder_sta015_sd_card.jal |
18f4620 | 18f4620_sd_card.jal |
18f4620 | 18f4620_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 | 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_offsetxmthead -- offset next byte from appl
var byte _serial_rcvbuf[SERIAL_RCVBUFSIZE] -- circular input buffer
var byte _serial_offsetxmttail -- offset next byte to port
var byte _serial_offsetrcvhead -- offset next byte from port
var byte _serial_offsetrcvtail -- offset next byte to appl
var bit serial_send_success -- serial_send_success is used internally
var byte _serial_xmtbuf[SERIAL_XMTBUFSIZE] -- circular output buffer
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_offsetxmthead -- offset next byte from appl
variable keeping track of next free position in transmit buffer
var byte _serial_rcvbuf[SERIAL_RCVBUFSIZE] -- circular input buffer
Local circular receive buffer
var byte _serial_offsetxmttail -- offset next byte to port
variable keeping track of next byte to be transmitted by interrupt handler
var byte _serial_offsetrcvhead -- offset next byte from port
variable keeping track of next free byte in receive buffer
var byte _serial_offsetrcvtail -- offset next byte to appl
variable keeping track of next byte available to application program
var bit serial_send_success -- serial_send_success is used internally
Flag indicating if transmission was successful
var byte _serial_xmtbuf[SERIAL_XMTBUFSIZE] -- circular output buffer
Local circular 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.
16f88 | 16f88_serial_sw_echo.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_4_reverse at servo_reverse : 3
var bit servo_8_reverse at servo_reverse : 7
var bit servo_5_reverse at servo_reverse : 4
var bit servo_6_on at servo_1_to_8_on : 5
var bit servo_1_reverse at servo_reverse : 0
var bit servo_2_reverse at servo_reverse : 1
var bit servo_7_reverse at servo_reverse : 6
var byte servo_reverse = 0x00 -- All servo's on by default
var byte servo_1_to_8_on = 0xFF -- All servo's on by default
var byte _servo_1_to_8_number_count = 0 -- ISR servo control count 0 to 7
var bit servo_6_reverse at servo_reverse : 5
var bit servo_3_reverse at servo_reverse : 2
var bit servo_8_on at servo_1_to_8_on : 7
var bit servo_5_on at servo_1_to_8_on : 4
var bit _servo_1_to_8_isr_count = 0 -- ISR step count (0 - servo pulse / 1 - idle state)
var bit servo_4_on at servo_1_to_8_on : 3
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_3_on at servo_1_to_8_on : 2
var bit servo_1_on at servo_1_to_8_on : 0
servo_move_percent(byte in percent, byte in servo_number)
servo_move(byte in location, byte in servo_number)
servo_init()
var bit servo_4_reverse at servo_reverse : 3
No documentation found
var bit servo_8_reverse at servo_reverse : 7
No documentation found
var bit servo_5_reverse at servo_reverse : 4
No documentation found
var bit servo_6_on at servo_1_to_8_on : 5
No documentation found
var bit servo_1_reverse at servo_reverse : 0
No documentation found
var bit servo_2_reverse at servo_reverse : 1
No documentation found
var bit servo_7_reverse at servo_reverse : 6
No documentation found
var byte servo_reverse = 0x00 -- All servo's on by default
use these bit variables to reverse servo direction
var byte servo_1_to_8_on = 0xFF -- All servo's on by default
use these variables to turn servo's on or off
var byte _servo_1_to_8_number_count = 0 -- ISR servo control count 0 to 7
No documentation found
var bit servo_6_reverse at servo_reverse : 5
No documentation found
var bit servo_3_reverse at servo_reverse : 2
No documentation found
var bit servo_8_on at servo_1_to_8_on : 7
No documentation found
var bit servo_5_on at servo_1_to_8_on : 4
No documentation found
var bit _servo_1_to_8_isr_count = 0 -- ISR step count (0 - servo pulse / 1 - idle state)
No documentation found
var bit servo_4_on at servo_1_to_8_on : 3
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_3_on at servo_1_to_8_on : 2
No documentation found
var bit servo_1_on at servo_1_to_8_on : 0
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.
const serial_hw_baudrate = 115200 -- set the baudrate
var bit _servo_rc_master_dedicated_ready at _servo_rc_master_dedicated_data : 6
var bit _servo_rc_master_dedicated_ready2 at _servo_rc_master_dedicated_data : 4
var bit _servo_rc_master_dedicated_ready4 at _servo_rc_master_dedicated_data : 0
var bit _servo_rc_master_dedicated_ready3 at _servo_rc_master_dedicated_data : 2
var bit _servo_rc_master_dedicated_error4 at _servo_rc_master_dedicated_data : 1
var byte _servo_rc_master_dedicated_data
var bit _servo_rc_master_dedicated_error at _servo_rc_master_dedicated_data : 7
const byte SERVO_RC_COMMAND_MIN = 96 -- set servo min movement
const byte SERVO_RC_COMMAND_MOVE = 0 -- move command
const byte SERVO_RC_COMMAND_REVERSE = 32 -- reverse servo command
const byte SERVO_RC_COMMAND_ON_OFF = 64 -- turn servo on/off
var bit _servo_rc_master_dedicated_error3 at _servo_rc_master_dedicated_data : 3
const byte SERVO_RC_COMMAND_MAX = 128 -- set servo max movement
var bit _servo_rc_master_dedicated_error2 at _servo_rc_master_dedicated_data : 5
servo_rc_error_i2c(byte in servo_ic_address) return bit
servo_rc_is_ready_i2c(byte in servo_ic_address) return bit
const serial_hw_baudrate = 115200 -- set the baudrate
setup uart for communication
var bit _servo_rc_master_dedicated_ready at _servo_rc_master_dedicated_data : 6
No documentation found
var bit _servo_rc_master_dedicated_ready2 at _servo_rc_master_dedicated_data : 4
No documentation found
var bit _servo_rc_master_dedicated_ready4 at _servo_rc_master_dedicated_data : 0
No documentation found
var bit _servo_rc_master_dedicated_ready3 at _servo_rc_master_dedicated_data : 2
No documentation found
var bit _servo_rc_master_dedicated_error4 at _servo_rc_master_dedicated_data : 1
No documentation found
var byte _servo_rc_master_dedicated_data
holds error & ready bit recieved from slave, internal use only
var bit _servo_rc_master_dedicated_error at _servo_rc_master_dedicated_data : 7
No documentation found
const byte SERVO_RC_COMMAND_MIN = 96 -- set servo min movement
No documentation found
const byte SERVO_RC_COMMAND_MOVE = 0 -- move command
servo commands that you may pass to the send_command procedure
const byte SERVO_RC_COMMAND_REVERSE = 32 -- reverse servo command
No documentation found
const byte SERVO_RC_COMMAND_ON_OFF = 64 -- turn servo on/off
No documentation found
var bit _servo_rc_master_dedicated_error3 at _servo_rc_master_dedicated_data : 3
No documentation found
const byte SERVO_RC_COMMAND_MAX = 128 -- set servo max movement
No documentation found
var bit _servo_rc_master_dedicated_error2 at _servo_rc_master_dedicated_data : 5
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 | 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 bit ACK = low
var byte mem_high = 0
var sword temperature = 0
const tobject = 0x07
const id_number0 = 0x0E ; read only
const smbus_sa = 0 ; SMbus Slave Address 7 bit, 0 to 6; 0x5b factory default
var volatile bit pwm_output_temp at config: 2 ; 1=Tambiant, 0=Tobject
var sword temperature_c = 0
const sleep_mode = 0b1100_0110
const bit NACK = high
const emissivity = 0x03
var byte mem_low = 0
var byte nack_counter = 0
var word w_t_high = 0
const pwm_t_range = 0x01
const id_number1 = 0x0F ; read only
var volatile bit pwm_frequency at config: 1 ; 1=low, 0=high
var byte t_high = 0
const config_reg = 0x02
var volatile bit*3 iir_setting at config: 12 ; see table below
var sword s_t_high = 0
var byte pec = 0
var word config
const eeprom_access = 0b0001_0000
var volatile bit*9 factory_cal at config: 3 ; do not alter
var word temperature_k = 0
const sword c27315 = 27315
var word temp = 0
const raw_ir_data = 0x05
var volatile bit mode_select at config: 0 ; 1=SMbus, 0=PWM
var volatile bit zero at config: 15 ; keep 0
const tambiant = 0x06
const ram_access = 0b0010_0000
var bit mlx90615_ack = high
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 bit ACK = low
No documentation found
var byte mem_high = 0
No documentation found
var sword temperature = 0
No documentation found
const tobject = 0x07
No documentation found
const id_number0 = 0x0E ; read only
No documentation found
const smbus_sa = 0 ; SMbus Slave Address 7 bit, 0 to 6; 0x5b factory default
No documentation found
var volatile bit pwm_output_temp at config: 2 ; 1=Tambiant, 0=Tobject
No documentation found
var sword temperature_c = 0
No documentation found
const sleep_mode = 0b1100_0110
No documentation found
const bit NACK = high
No documentation found
const emissivity = 0x03
No documentation found
var byte mem_low = 0
No documentation found
var byte nack_counter = 0
No documentation found
var word w_t_high = 0
No documentation found
const pwm_t_range = 0x01
No documentation found
const id_number1 = 0x0F ; read only
No documentation found
var volatile bit pwm_frequency at config: 1 ; 1=low, 0=high
No documentation found
var byte t_high = 0
var byte t_low = 0
const config_reg = 0x02
No documentation found
var volatile bit*3 iir_setting at config: 12 ; see table below
No documentation found
var sword s_t_high = 0
No documentation found
var byte pec = 0
No documentation found
var word config
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
var word temperature_k = 0
No documentation found
const sword c27315 = 27315
No documentation found
var word temp = 0
No documentation found
const raw_ir_data = 0x05
0x04 to 0x4h Melexis reserved
var volatile bit mode_select at config: 0 ; 1=SMbus, 0=PWM
No documentation found
var volatile bit zero at config: 15 ; keep 0
No documentation found
const tambiant = 0x06
No documentation found
const ram_access = 0b0010_0000
No documentation found
var bit mlx90615_ack = high
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 | William Welch Copyright (c) 2009, all rights reserved. |
Adapted-by | |
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
No dependency found
const SPI_MODE_01 = 1
const SPI_RATE_FOSC_4 = 0
const SPI_RATE_FOSC_16 = 1
const SPI_MODE_10 = 2
const SPI_RATE_TMR = 3
const SPI_MODE_00 = 0
const SPI_MODE_11 = 3
const SPI_RATE_FOSC_64 = 2
const SPI_MODE_01 = 1
No documentation found
const SPI_RATE_FOSC_4 = 0
Use these when calling the spi_init() routine below ( SPI clock frequency )
const SPI_RATE_FOSC_16 = 1
No documentation found
const SPI_MODE_10 = 2
No documentation found
const SPI_RATE_TMR = 3
No documentation found
const SPI_MODE_00 = 0
Use these when calling the spi_init() routine below ( SPI master mode, see sources above )
const SPI_MODE_11 = 3
No documentation found
const SPI_RATE_FOSC_64 = 2
No documentation found
spi_master_hw'put(byte in data)
half-duplex convenience function. send data to slave, discard reply
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_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 | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
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_WRITE_COMMAND = 0b_0000_0010 -- Write data to memory array beginning at selected address
const byte SRAM_23K256_READ_STATUS = 0b_0000_0101 -- Read STATUS register
const byte SRAM_23K256_READ_COMMAND = 0b_0000_0011 -- Read data from memory array beginning at selected address
const byte SRAM_23K256_WRITE_SETTINGS = 0b_0000_0001 -- Write STATUS register
const byte SRAM_23K256_SEQUENTIAL_MODE = 0b01 -- send read command then read many bytes
const byte SRAM_23K256_BYTE_MODE = 0b00 -- read only one byte
const byte SRAM_23K256_HOLD_ENABLE = 0 -- enable the hold pin (conect pin to microcontroller)
const byte SRAM_23K256_PAGE_MODE = 0b10 -- send read command then read 1 32Byte page
const byte SRAM_23K256_HOLD_DISABLE = 1 -- disable the hold pin. (connect put pin direct to 3.3v)
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_WRITE_COMMAND = 0b_0000_0010 -- Write data to memory array beginning at selected address
No documentation found
const byte SRAM_23K256_READ_STATUS = 0b_0000_0101 -- Read STATUS register
No documentation found
const byte SRAM_23K256_READ_COMMAND = 0b_0000_0011 -- Read data from memory array beginning at selected address
constants for internal usage
const byte SRAM_23K256_WRITE_SETTINGS = 0b_0000_0001 -- Write STATUS register
No documentation found
const byte SRAM_23K256_SEQUENTIAL_MODE = 0b01 -- send read command then read many bytes
No documentation found
const byte SRAM_23K256_BYTE_MODE = 0b00 -- read only one byte
constants for use with init procedure input data modes in witch to read and write data
const byte SRAM_23K256_HOLD_ENABLE = 0 -- enable the hold pin (conect pin to microcontroller)
No documentation found
const byte SRAM_23K256_PAGE_MODE = 0b10 -- send read command then read 1 32Byte page
No documentation found
const byte SRAM_23K256_HOLD_DISABLE = 1 -- disable the hold pin. (connect put pin direct to 3.3v)
No documentation found
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_hw 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 | 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) 2008 |
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. This library assumes two pins: global bit SCK, wired to SCK of device and global bit SIO,wired to SIO of device. SCK should be output, SIO input. Writing the status_word is not supported here.
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
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 byte timer0_load
No documentation found
var word isr_countdown[DELAY_SLOTS]
No documentation found
var word internal_isr_counter
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_countdown[DELAY_SLOTS]
No documentation found
var word timer0_load
preload value for timer0
var word timer0_interval_counter
No documentation found
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 dword _ut_trash_dword
var volatile bit _ut_trash_bit
var volatile word _ut_trash_word
var volatile sword _ut_trash_sword
var volatile byte _ut_trash_byte
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 dword _ut_trash_dword
No documentation found
var volatile bit _ut_trash_bit
No documentation found
var volatile word _ut_trash_word
No documentation found
var volatile sword _ut_trash_sword
No documentation found
var volatile byte _ut_trash_byte
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 |
Compiler | >=2.4g |
USART common functions This file provides common functions to other libraries. 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.
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 (see also page 74/75 of DS40300B): {{{ if TXSTA_BRGH = 0 (low speed) SPBRG = ( Fosc / ( 64 * Baudrate ) ) -1 if TXSTA_BRGH = 1 (high speed) SPBRG = ( Fosc / ( 16 * 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 bit EP2CONDIS at UEP2:3
var volatile byte usb_bd5in_cnt at usb_bd5in[1]
var volatile byte usb_bd5in_stat at usb_bd5in[0]
const byte USB_REQUEST_REQ_SYNCH_FRAME = 0x0c
const byte USB_DT_DEBUG = 0x0a
var volatile word usb_bd5out_addr at usb_bd5out[2]
var byte usb_delivery_buffer_size
var volatile byte usb_bd4in[4] at ( USB_BASE_ADDRESS + 0x0024 )
var volatile bit EP3CONDIS at UEP3:3
const byte USB_DT_OTG = 0x09
const byte USB_BD_CNT_IDX = 0x01
var volatile byte usb_sdp_request at usb_sdp_loc + 1
var volatile byte usb_bd3in_cnt at usb_bd3in[1]
const byte USB_CM_CTRL_WRITE_DATA_STAGE_CLASS = 2 -- Device receiving data during the data stage destined for the class
var byte usb_delivery_bytes_max_send
var byte usb_control_mode
var volatile bit EP3OUTEN at UEP3:2
const byte USB_REQUEST_SET_CONFIGURATION = 0x09
const byte USB_STATE_CONFIGURED = 3 -- USB device is completely configured and ready to rock and roll
const byte USB_HID_PROTOCOL_NONE = 0x00
var volatile byte usb_bd2out[4] at ( USB_BASE_ADDRESS + 0x0010 )
var volatile byte usb_bd1in_addrl at usb_bd1in[2]
const byte USB_PID_NYET = 0b00000110
const byte USB_REQUEST_CLEAR_FEATURE = 0x01
const word USB_IN_DELIVERY_BUFFER_LOC = ( USB_BASE_ADDRESS + 0x0078 )
var volatile byte usb_bd0out_addrl at usb_bd0out[2]
var volatile byte usb_bd5in_addrh at usb_bd5in[3]
var volatile bit EP2HSHK at UEP2:4
const byte USB_EXTERNAL_TRANSCEIVER = 0x08
var volatile byte usb_bd0out_addrh at usb_bd0out[3]
const byte USB_CM_CTRL_WRITE_DATA_STAGE = 1 -- Device receiving data during the data stage
const byte USB_REQUEST_SET_ADDRESS = 0x05
const byte USB_DT_INTERFACE_POWER = 0x08
const byte USB_HID_PROTOCOL_KEYBOARD = 0x01
const byte USB_EP_OUT = 0x0C -- Cfg OUT only pipe for this ep
var volatile byte usb_bd5out_cnt at usb_bd5out[1]
const byte USB_PING_PONG__ALL_BUT_EP0 = 0x03 -- 0b11
var volatile byte usb_bd1out_addrh at usb_bd1out[3]
const byte USB_PID_MDATA = 0b00001111
const byte USB_DT_CS_INTERFACE = 0x24
const byte USB_CM_CTRL_WRITE_SENDING_STATUS = 6 -- Device is sending status after receiving data
const byte USB_REQUEST_SET_INTERFACE = 0x0b
const byte USB_EPT_BULK = 0x02 -- Bulk Transfer
var volatile byte usb_bd3out_stat at usb_bd3out[0]
var volatile byte usb_bd2in_cnt at usb_bd2in[1]
var volatile word usb_bd1out_addr at usb_bd1out[2]
var volatile byte usb_bd5in_addrl at usb_bd5in[2]
const byte USB_ABSTRACT_CONTROL_MODEL = 0x02
var volatile word usb_sdp_length at usb_sdp_loc + 6
const byte USB_BDSTATUS_BC9 = 1 -- bit 9 of buffer count
const byte USB_DT_HID_REPORT = 0x22
const USB_REQUEST_TYPE0_BIT = 5 -- 01= Request for a specific class
var byte usb_status
const byte USB_BD_ADDRL_IDX = 0x03
var volatile byte usb_bd5in[4] at ( USB_BASE_ADDRESS + 0x002C )
const byte USB_STATE_DEFAULT = 1 -- USB device is now negotiating
const byte USB_PID_IN = 0b00001001
const byte USB_PID_DATA1 = 0b00001011
var volatile byte usb_bd1out_cnt at usb_bd1out[1]
var volatile byte usb_bd1out[4] at ( USB_BASE_ADDRESS + 0x0008 )
var volatile bit EP1CONDIS at UEP1:3
const byte USB_BDSTATUS_KEN = 5 -- 1 USB will keep buffer indefinately, 0 USB will hand back buffer
const byte USB_STATE_POWERED = 0 -- USB device is powered up, ready to start negotiating
var volatile word usb_bd3out_addr at usb_bd3out[2]
var volatile byte usb_bd4out_addrh at usb_bd4out[3]
const byte USB_DT_HID = 0x21
const byte USB_INTERNAL_TRANSCEIVER = 0x00
var byte usb_delivery_bytes_to_send
var volatile byte usb_bd0in_addrh at usb_bd0in[3]
var volatile byte usb_bd1out_stat at usb_bd1out[0]
const byte USB_COMM_INTF = 0x02
var volatile byte usb_bd0in_stat at usb_bd0in[0]
var volatile byte usb_bd4out_cnt at usb_bd4out[1]
var volatile byte usb_bd1in[4] at ( USB_BASE_ADDRESS + 0x000C )
var volatile word usb_bd0in_addr at usb_bd0in[2]
const byte USB_EP_OUT_IN = 0x0E -- Cfg both OUT & IN pipes for this ep
var volatile byte usb_bd3out_cnt at usb_bd3out[1]
var volatile byte usb_bd4out_stat at usb_bd4out[0]
var volatile word usb_sdp_value at usb_sdp_loc + 2
const byte USB_VENDOR_INTF = 0xFF
var volatile byte usb_bd2in_addrl at usb_bd2in[2]
var volatile byte usb_bd2in_addrh at usb_bd2in[3]
const byte USB_DT_INTERFACE = 0x04
var volatile byte usb_bd3in_addrh at usb_bd3in[3]
var volatile word usb_bd1in_addr at usb_bd1in[2]
const byte USB_BDSTATUS_BSTALL = 2 -- 1 buffer stall enabled, 0 buffer stall disabled
const byte USB_CM_CTRL_READ_AWAITING_STATUS = 5 -- Device is awaiting reception of status after sending data
var volatile byte usb_bd_array[ 255 ] at ( USB_BASE_ADDRESS + 0x0000 )
const byte USB_EPT_ISO = 0x01 -- Isochronous Transfer
var volatile bit EP3STALL at UEP3:0
const byte USB_BDSTATUS_UOWN = 7 -- 0 if uC owns buffer
var volatile bit EP3HSHK at UEP3:4
var volatile byte usb_bd1in_addrh at usb_bd1in[3]
var volatile byte usb_bd5out_stat at usb_bd5out[0]
const byte USB_V25TER = 0x01 -- Common AT commands ("Hayes(TM)")
var volatile byte usb_bd3in_addrl at usb_bd3in[2]
const byte USB_DT_INTERFACE_ASSOC = 0x0b
const byte USB_REQUEST_GET_DESCRIPTOR = 0x06
var volatile bit EP3INEN at UEP3:1
var byte usb_delivery_buffer[ 8 ] at USB_IN_DELIVERY_BUFFER_LOC
const byte USB_HID_INTF = 0x03
var volatile word usb_bd2out_addr at usb_bd2out[2]
const byte USB_DT_DEVICE_QUALIFIER = 0x06
const byte USB_PID_DATA2 = 0b00000111
var volatile word usb_bd3in_addr at usb_bd3in[2]
var volatile byte usb_bd4in_addrl at usb_bd4in[2]
const byte USB_STATUS_SET_ADDRESS = 1
var volatile bit EP2INEN at UEP2:1
var volatile byte usb_bd2out_stat at usb_bd2out[0]
const byte USB_BDSTATUS_BC8 = 0 -- bit 8 of buffer count
const byte USB_LOW_SPEED = 0x00
var volatile byte usb_sdp[8] at usb_sdp_loc
var volatile bit EP1HSHK at UEP1:4
const byte USB_BDSTATUS_INCDIS = 4 -- 1 Address increment disabled (for SPP), 0 address increment enabled
const bit USB_SELF_POWERED = 1
const byte USB_EP_CTRL = 0x06 -- Cfg Control pipe for this ep
const byte USB_STATE_ADDRESS = 2 -- USB device now has an address
const byte USB_BD_STAT_IDX = 0x00
var volatile byte usb_bd4out[4] at ( USB_BASE_ADDRESS + 0x0020 )
const byte USB_STATUS_IDLE = 0
var volatile byte usb_bd0out[4] at ( USB_BASE_ADDRESS + 0x0000 )
var volatile bit EP2STALL at UEP2:0
var volatile byte usb_bd0out_cnt at usb_bd0out[1]
var volatile word usb_bd4out_addr at usb_bd4out[2]
var volatile byte usb_bd2out_cnt at usb_bd2out[1]
var volatile bit EP2OUTEN at UEP2:2
var volatile byte usb_bd5out_addrh at usb_bd5out[3]
const byte USB_BD_ADDRH_IDX = 0x02
var volatile word usb_bd2in_addr at usb_bd2in[2]
var volatile byte usb_bd3in_stat at usb_bd3in[0]
const byte USB_CDC_DEVICE = 0x02
const byte USB_PID_OUT = 0b00000001
const byte USB_BDSTATUS_DTSEN = 3 -- 1 data toggle sync on, 0 data toggle sync off
const byte USB_PULLUP_DISABLED = 0x00
const byte USB_EPT_CTRL = 0x00 -- Control Transfer
const byte USB_PID_DATA0 = 0b00000011
var volatile byte usb_bd1in_stat at usb_bd1in[0]
const byte USB_REQUEST_SET_DESCRIPTOR = 0x07
var volatile byte usb_bd3out_addrl at usb_bd3out[2]
const byte USB_REQUEST_GET_INTERFACE = 0x0a
var volatile byte usb_bd3out_addrh at usb_bd3out[3]
const byte USB_REQUEST_SET_FEATURE = 0x03
var byte usb_address
var volatile byte usb_bd2out_addrh at usb_bd2out[3]
var volatile byte usb_bd1out_addrl at usb_bd1out[2]
const byte USB_PID_STALL = 0b00001110
var volatile byte usb_bd2in[4] at ( USB_BASE_ADDRESS + 0x0014 )
var volatile byte usb_bd4in_cnt at usb_bd4in[1]
var volatile bit EP1INEN at UEP1:1
var volatile byte usb_bd4in_stat at usb_bd4in[0]
var volatile byte usb_bd0in[4] at ( USB_BASE_ADDRESS + 0x0004 )
var volatile word usb_bd4in_addr at usb_bd4in[2]
const USB_DEVICE_DESCRIPTOR_SIZE = 18
var volatile byte usb_bd5out_addrl at usb_bd5out[2]
const byte USB_PULLUP_ENABLE = 0x10
const byte USB_DT_CONFIGURATION = 0x02
var volatile byte usb_bd0out_stat at usb_bd0out[0]
const byte USB_DT_OTHER_SPEED_CONFIG = 0x07
var volatile word usb_bd0out_addr at usb_bd0out[2]
const byte USB_FULL_SPEED = 0x04
const byte USB_EPT_INT = 0x03 -- Interrupt Transfer
const word usb_sdp_loc = ( USB_BASE_ADDRESS + 0x00F8 )
var volatile byte usb_bd3out[4] at ( USB_BASE_ADDRESS + 0x0018 )
var volatile byte usb_bd4out_addrl at usb_bd4out[2]
var volatile byte usb_bd5out[4] at ( USB_BASE_ADDRESS + 0x0028 )
var volatile byte usb_bd2in_stat at usb_bd2in[0]
var byte usb_delivery_bytes_sent
const byte USB_PID_SETUP = 0b00001101
var volatile byte usb_bd1in_cnt at usb_bd1in[1]
var volatile byte usb_sdp_request_type at usb_sdp_loc
const byte USB_DT_STRING = 0x03
const byte USB_BOOT_INTF_SUBCLASS = 0x01
var volatile byte usb_bd4in_addrh at usb_bd4in[3]
const byte USB_HID_PROTOCOL_MOUSE = 0x02
var volatile word usb_bd5in_addr at usb_bd5in[2]
var volatile bit EP1STALL at UEP1:0
const byte USB_EP_IN = 0x0A -- Cfg IN only pipe for this ep
var volatile byte usb_bd0in_cnt at usb_bd0in[1]
const USB_REQUEST_TYPE1_BIT = 6 -- 00= USB standard request
const byte USB_PING_PONG__FULL_PING_PONG = 0x02 -- 0b10
var volatile word usb_sdp_index at usb_sdp_loc + 4
const USB_DATA_STAGE_DIR_BIT = 7
const byte USB_PID_SOF = 0b00000101
const byte USB_CM_CTRL_READ_DATA_STAGE = 3 -- Device sending data during the data stage
var volatile byte usb_bd3in[4] at ( USB_BASE_ADDRESS + 0x001C )
const byte USB_HSHK_EN = 0x10 -- Enable handshake packet
const byte USB_PING_PONG__NO_PING_PONG = 0x00 -- 0b00
const byte USB_PING_PONG__EP0_OUT_ONLY = 0x01 -- 0b01
const byte USB_CM_IDLE = 0 -- No control transfer taking place
const byte USB_HIGHEST_EP = 3
const byte USB_BDSTATUS_DTS = 6 -- 1 data 1 packet, 0 data 0 packet
var byte usb_state = USB_STATE_POWERED
var volatile byte usb_bd2out_addrl at usb_bd2out[2]
var volatile bit EP1OUTEN at UEP1:2
const byte USB_REQUEST_GET_STATUS = 0x00
const byte USB_CM_CTRL_READ_DATA_STAGE_CLASS = 4 -- Device class is sending data during the data stage
const byte USB_DT_ENDPOINT = 0x05
const byte USB_PID_ACK = 0b00000010
var volatile byte usb_bd0in_addrl at usb_bd0in[2]
const byte USB_PID_NAK = 0b00001010
const byte USB_REQUEST_GET_CONFIGURATION = 0x08
const byte USB_DT_DEVICE = 0x01
var volatile bit EP2CONDIS at UEP2:3
No documentation found
var volatile byte usb_bd5in_cnt at usb_bd5in[1]
No documentation found
var volatile byte usb_bd5in_stat at usb_bd5in[0]
No documentation found
const byte USB_REQUEST_REQ_SYNCH_FRAME = 0x0c
No documentation found
const byte USB_DT_DEBUG = 0x0a
No documentation found
var volatile word usb_bd5out_addr at usb_bd5out[2]
No documentation found
var byte usb_delivery_buffer_size
No documentation found
var volatile byte usb_bd4in[4] at ( USB_BASE_ADDRESS + 0x0024 )
No documentation found
var volatile bit EP3CONDIS at UEP3:3
No documentation found
const byte USB_DT_OTG = 0x09
No documentation found
const byte USB_BD_CNT_IDX = 0x01
No documentation found
var volatile byte usb_sdp_request at usb_sdp_loc + 1
No documentation found
var volatile byte usb_bd3in_cnt at usb_bd3in[1]
No documentation found
const byte USB_CM_CTRL_WRITE_DATA_STAGE_CLASS = 2 -- Device receiving data during the data stage destined for the class
No documentation found
var byte usb_delivery_bytes_max_send
No documentation found
var byte usb_control_mode
No documentation found
var volatile bit EP3OUTEN at UEP3:2
No documentation found
const byte USB_REQUEST_SET_CONFIGURATION = 0x09
No documentation found
const byte USB_STATE_CONFIGURED = 3 -- USB device is completely configured and ready to rock and roll
No documentation found
const byte USB_HID_PROTOCOL_NONE = 0x00
HID Interface Class Protocol Codes
var volatile byte usb_bd2out[4] at ( USB_BASE_ADDRESS + 0x0010 )
No documentation found
var volatile byte usb_bd1in_addrl at usb_bd1in[2]
No documentation found
const byte USB_PID_NYET = 0b00000110
No documentation found
const byte USB_REQUEST_CLEAR_FEATURE = 0x01
No documentation found
const word USB_IN_DELIVERY_BUFFER_LOC = ( USB_BASE_ADDRESS + 0x0078 )
No documentation found
var volatile byte usb_bd0out_addrl at usb_bd0out[2]
No documentation found
var volatile byte usb_bd5in_addrh at usb_bd5in[3]
No documentation found
var volatile bit EP2HSHK at UEP2:4
No documentation found
const byte USB_EXTERNAL_TRANSCEIVER = 0x08
No documentation found
var volatile byte usb_bd0out_addrh at usb_bd0out[3]
No documentation found
const byte USB_CM_CTRL_WRITE_DATA_STAGE = 1 -- Device receiving data during the data stage
No documentation found
const byte USB_REQUEST_SET_ADDRESS = 0x05
No documentation found
const byte USB_DT_INTERFACE_POWER = 0x08
No documentation found
const byte USB_HID_PROTOCOL_KEYBOARD = 0x01
No documentation found
const byte USB_EP_OUT = 0x0C -- Cfg OUT only pipe for this ep
No documentation found
var volatile byte usb_bd5out_cnt at usb_bd5out[1]
No documentation found
const byte USB_PING_PONG__ALL_BUT_EP0 = 0x03 -- 0b11
No documentation found
var volatile byte usb_bd1out_addrh at usb_bd1out[3]
No documentation found
const byte USB_PID_MDATA = 0b00001111
No documentation found
const byte USB_DT_CS_INTERFACE = 0x24
No documentation found
const byte USB_CM_CTRL_WRITE_SENDING_STATUS = 6 -- Device is sending status after receiving data
No documentation found
const byte USB_REQUEST_SET_INTERFACE = 0x0b
No documentation found
const byte USB_EPT_BULK = 0x02 -- Bulk Transfer
No documentation found
var volatile byte usb_bd3out_stat at usb_bd3out[0]
No documentation found
var volatile byte usb_bd2in_cnt at usb_bd2in[1]
No documentation found
var volatile word usb_bd1out_addr at usb_bd1out[2]
No documentation found
var volatile byte usb_bd5in_addrl at usb_bd5in[2]
No documentation found
const byte USB_ABSTRACT_CONTROL_MODEL = 0x02
Communication Interface Class SubClass Codes
var volatile word usb_sdp_length at usb_sdp_loc + 6
No documentation found
const byte USB_BDSTATUS_BC9 = 1 -- bit 9 of buffer count
No documentation found
const byte USB_DT_HID_REPORT = 0x22
No documentation found
const USB_REQUEST_TYPE0_BIT = 5 -- 01= Request for a specific class
No documentation found
var byte usb_status
No documentation found
const byte USB_BD_ADDRL_IDX = 0x03
No documentation found
var volatile byte usb_bd5in[4] at ( USB_BASE_ADDRESS + 0x002C )
No documentation found
const byte USB_STATE_DEFAULT = 1 -- USB device is now negotiating
No documentation found
const byte USB_PID_IN = 0b00001001
No documentation found
const byte USB_PID_DATA1 = 0b00001011
No documentation found
var volatile byte usb_bd1out_cnt at usb_bd1out[1]
No documentation found
var volatile byte usb_bd1out[4] at ( USB_BASE_ADDRESS + 0x0008 )
No documentation found
var volatile bit EP1CONDIS at UEP1:3
No documentation found
const byte USB_BDSTATUS_KEN = 5 -- 1 USB will keep buffer indefinately, 0 USB will hand back buffer
No documentation found
const byte USB_STATE_POWERED = 0 -- USB device is powered up, ready to start negotiating
USB STATE
var volatile word usb_bd3out_addr at usb_bd3out[2]
No documentation found
var volatile byte usb_bd4out_addrh at usb_bd4out[3]
No documentation found
const byte USB_DT_HID = 0x21
No documentation found
const byte USB_INTERNAL_TRANSCEIVER = 0x00
No documentation found
var byte usb_delivery_bytes_to_send
No documentation found
var volatile byte usb_bd0in_addrh at usb_bd0in[3]
No documentation found
var volatile byte usb_bd1out_stat at usb_bd1out[0]
No documentation found
const byte USB_COMM_INTF = 0x02
Communication Interface Class Code
var volatile byte usb_bd0in_stat at usb_bd0in[0]
No documentation found
var volatile byte usb_bd4out_cnt at usb_bd4out[1]
No documentation found
var volatile byte usb_bd1in[4] at ( USB_BASE_ADDRESS + 0x000C )
No documentation found
var volatile word usb_bd0in_addr at usb_bd0in[2]
No documentation found
const byte USB_EP_OUT_IN = 0x0E -- Cfg both OUT & IN pipes for this ep
No documentation found
var volatile byte usb_bd3out_cnt at usb_bd3out[1]
No documentation found
var volatile byte usb_bd4out_stat at usb_bd4out[0]
No documentation found
var volatile word usb_sdp_value at usb_sdp_loc + 2
No documentation found
const byte USB_VENDOR_INTF = 0xFF
Vendor specific interface code
var volatile byte usb_bd2in_addrl at usb_bd2in[2]
No documentation found
var volatile byte usb_bd2in_addrh at usb_bd2in[3]
No documentation found
const byte USB_DT_INTERFACE = 0x04
No documentation found
var volatile byte usb_bd3in_addrh at usb_bd3in[3]
No documentation found
var volatile word usb_bd1in_addr at usb_bd1in[2]
No documentation found
const byte USB_BDSTATUS_BSTALL = 2 -- 1 buffer stall enabled, 0 buffer stall disabled
No documentation found
const byte USB_CM_CTRL_READ_AWAITING_STATUS = 5 -- Device is awaiting reception of status after sending data
No documentation found
var volatile byte usb_bd_array[ 255 ] at ( USB_BASE_ADDRESS + 0x0000 )
No documentation found
const byte USB_EPT_ISO = 0x01 -- Isochronous Transfer
No documentation found
var volatile bit EP3STALL at UEP3:0
No documentation found
const byte USB_BDSTATUS_UOWN = 7 -- 0 if uC owns buffer
Bits of BDn.stat when UOWN = 0
var volatile bit EP3HSHK at UEP3:4
No documentation found
var volatile byte usb_bd1in_addrh at usb_bd1in[3]
No documentation found
var volatile byte usb_bd5out_stat at usb_bd5out[0]
No documentation found
const byte USB_V25TER = 0x01 -- Common AT commands ("Hayes(TM)")
Communication Interface Class Control Protocol Codes
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_REQUEST_GET_DESCRIPTOR = 0x06
No documentation found
var volatile bit EP3INEN at UEP3:1
No documentation found
var byte usb_delivery_buffer[ 8 ] at USB_IN_DELIVERY_BUFFER_LOC
No documentation found
const byte USB_HID_INTF = 0x03
No documentation found
var volatile word usb_bd2out_addr at usb_bd2out[2]
No documentation found
const byte USB_DT_DEVICE_QUALIFIER = 0x06
No documentation found
const byte USB_PID_DATA2 = 0b00000111
No documentation found
var volatile word usb_bd3in_addr at usb_bd3in[2]
No documentation found
var volatile byte usb_bd4in_addrl at usb_bd4in[2]
No documentation found
const byte USB_STATUS_SET_ADDRESS = 1
No documentation found
var volatile bit EP2INEN at UEP2:1
No documentation found
var volatile byte usb_bd2out_stat at usb_bd2out[0]
No documentation found
const byte USB_BDSTATUS_BC8 = 0 -- bit 8 of buffer count
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
var volatile bit EP1HSHK at UEP1:4
No documentation found
const byte USB_BDSTATUS_INCDIS = 4 -- 1 Address increment disabled (for SPP), 0 address increment enabled
No documentation found
const bit USB_SELF_POWERED = 1
No documentation found
const byte USB_EP_CTRL = 0x06 -- Cfg Control pipe for this ep
No documentation found
const byte USB_STATE_ADDRESS = 2 -- USB device now has an address
No documentation found
const byte USB_BD_STAT_IDX = 0x00
No documentation found
var volatile byte usb_bd4out[4] at ( USB_BASE_ADDRESS + 0x0020 )
No documentation found
const byte USB_STATUS_IDLE = 0
USB_STATUS
var volatile byte usb_bd0out[4] at ( USB_BASE_ADDRESS + 0x0000 )
No documentation found
var volatile bit EP2STALL at UEP2:0
No documentation found
var volatile byte usb_bd0out_cnt at usb_bd0out[1]
No documentation found
var volatile word usb_bd4out_addr at usb_bd4out[2]
No documentation found
var volatile byte usb_bd2out_cnt at usb_bd2out[1]
No documentation found
var volatile bit EP2OUTEN at UEP2:2
No documentation found
var volatile byte usb_bd5out_addrh at usb_bd5out[3]
No documentation found
const byte USB_BD_ADDRH_IDX = 0x02
No documentation found
var volatile word usb_bd2in_addr at usb_bd2in[2]
No documentation found
var volatile byte usb_bd3in_stat at usb_bd3in[0]
No documentation found
const byte USB_CDC_DEVICE = 0x02
Device Class Code
const byte USB_PID_OUT = 0b00000001
Token
const byte USB_BDSTATUS_DTSEN = 3 -- 1 data toggle sync on, 0 data toggle sync off
No documentation found
const byte USB_PULLUP_DISABLED = 0x00
No documentation found
const byte USB_EPT_CTRL = 0x00 -- Control Transfer
Endpoint Transfer Type
const byte USB_PID_DATA0 = 0b00000011
Data
var volatile byte usb_bd1in_stat at usb_bd1in[0]
No documentation found
const byte USB_REQUEST_SET_DESCRIPTOR = 0x07
No documentation found
var volatile byte usb_bd3out_addrl at usb_bd3out[2]
No documentation found
const byte USB_REQUEST_GET_INTERFACE = 0x0a
No documentation found
var volatile byte usb_bd3out_addrh at usb_bd3out[3]
No documentation found
const byte USB_REQUEST_SET_FEATURE = 0x03
No documentation found
var byte usb_address
No documentation found
var volatile byte usb_bd2out_addrh at usb_bd2out[3]
No documentation found
var volatile byte usb_bd1out_addrl at usb_bd1out[2]
No documentation found
const byte USB_PID_STALL = 0b00001110
No documentation found
var volatile byte usb_bd2in[4] at ( USB_BASE_ADDRESS + 0x0014 )
No documentation found
var volatile byte usb_bd4in_cnt at usb_bd4in[1]
No documentation found
var volatile bit EP1INEN at UEP1:1
No documentation found
var volatile byte usb_bd4in_stat at usb_bd4in[0]
No documentation found
var volatile byte usb_bd0in[4] at ( USB_BASE_ADDRESS + 0x0004 )
No documentation found
var volatile word usb_bd4in_addr at usb_bd4in[2]
No documentation found
const USB_DEVICE_DESCRIPTOR_SIZE = 18
No documentation found
var volatile byte usb_bd5out_addrl at usb_bd5out[2]
No documentation found
const byte USB_PULLUP_ENABLE = 0x10
No documentation found
const byte USB_DT_CONFIGURATION = 0x02
No documentation found
var volatile byte usb_bd0out_stat at usb_bd0out[0]
No documentation found
const byte USB_DT_OTHER_SPEED_CONFIG = 0x07
No documentation found
var volatile word usb_bd0out_addr at usb_bd0out[2]
No documentation found
const byte USB_FULL_SPEED = 0x04
No documentation found
const byte USB_EPT_INT = 0x03 -- Interrupt Transfer
No documentation found
const word usb_sdp_loc = ( USB_BASE_ADDRESS + 0x00F8 )
No documentation found
var volatile byte usb_bd3out[4] at ( USB_BASE_ADDRESS + 0x0018 )
No documentation found
var volatile byte usb_bd4out_addrl at usb_bd4out[2]
No documentation found
var volatile byte usb_bd5out[4] at ( USB_BASE_ADDRESS + 0x0028 )
No documentation found
var volatile byte usb_bd2in_stat at usb_bd2in[0]
No documentation found
var byte usb_delivery_bytes_sent
No documentation found
const byte USB_PID_SETUP = 0b00001101
No documentation found
var volatile byte usb_bd1in_cnt at usb_bd1in[1]
No documentation found
var volatile byte usb_sdp_request_type at usb_sdp_loc
No documentation found
const byte USB_DT_STRING = 0x03
No documentation found
const byte USB_BOOT_INTF_SUBCLASS = 0x01
No documentation found
var volatile byte usb_bd4in_addrh at usb_bd4in[3]
No documentation found
const byte USB_HID_PROTOCOL_MOUSE = 0x02
No documentation found
var volatile word usb_bd5in_addr at usb_bd5in[2]
No documentation found
var volatile bit EP1STALL at UEP1:0
No documentation found
const byte USB_EP_IN = 0x0A -- Cfg IN only pipe for this ep
No documentation found
var volatile byte usb_bd0in_cnt at usb_bd0in[1]
No documentation found
const USB_REQUEST_TYPE1_BIT = 6 -- 00= USB standard request
No documentation found
const byte USB_PING_PONG__FULL_PING_PONG = 0x02 -- 0b10
No documentation found
var volatile word usb_sdp_index at usb_sdp_loc + 4
No documentation found
const USB_DATA_STAGE_DIR_BIT = 7
No documentation found
const byte USB_PID_SOF = 0b00000101
No documentation found
const byte USB_CM_CTRL_READ_DATA_STAGE = 3 -- Device sending data during the data stage
No documentation found
var volatile byte usb_bd3in[4] at ( USB_BASE_ADDRESS + 0x001C )
No documentation found
const byte USB_HSHK_EN = 0x10 -- Enable handshake packet
No documentation found
const byte USB_PING_PONG__NO_PING_PONG = 0x00 -- 0b00
No documentation found
const byte USB_PING_PONG__EP0_OUT_ONLY = 0x01 -- 0b01
No documentation found
const byte USB_CM_IDLE = 0 -- No control transfer taking place
USB COMMAND MODES
const byte USB_HIGHEST_EP = 3
No documentation found
const byte USB_BDSTATUS_DTS = 6 -- 1 data 1 packet, 0 data 0 packet
No documentation found
var byte usb_state = USB_STATE_POWERED
No documentation found
var volatile byte usb_bd2out_addrl at usb_bd2out[2]
No documentation found
var volatile bit EP1OUTEN at UEP1:2
No documentation found
const byte USB_REQUEST_GET_STATUS = 0x00
USB REQUESTS
const byte USB_CM_CTRL_READ_DATA_STAGE_CLASS = 4 -- Device class is sending data during the data stage
No documentation found
const byte USB_DT_ENDPOINT = 0x05
No documentation found
const byte USB_PID_ACK = 0b00000010
Handshake
var volatile byte usb_bd0in_addrl at usb_bd0in[2]
No documentation found
const byte USB_PID_NAK = 0b00001010
No documentation found
const byte USB_REQUEST_GET_CONFIGURATION = 0x08
No documentation found
const byte USB_DT_DEVICE = 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_free = USB_CDC_RX_BUFFER_SIZE
var byte cdc_line_status = 0x00
const byte USB_REQ_SEND_BREAK = 0x23
const byte USB_REQ_SET_LINE_CODING = 0x20
var volatile byte cdc_tx_wr=0
var volatile byte cdc_rx_rd = 0
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[7]
const byte USB_REQ_SET_CONTROL_LINE_STATE = 0x22
const byte USB_REQ_GET_ENCAPSULATED_RESPONSE = 0x01
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
var volatile dword cdc_line_coding_dte_rate at cdc_line_coding[0]
var byte cdc_rx_buffer[USB_CDC_RX_BUFFER_SIZE]
const byte USB_REQ_SET_COMM_FEATURE = 0x02
var bit last_packet_is_full = false
const byte USB_REQ_SEND_ENCAPSULATED_COMMAND = 0x00
var volatile byte cdc_tx_rd=0
const byte USB_REQ_CLEAR_COMM_FEATURE = 0x04
var volatile byte cdc_rx_wr = 0
var volatile byte cdc_line_coding_data_bits at cdc_line_coding[6] -- 5,6,7,8 or 16 bits
const byte USB_REQ_GET_LINE_CODING = 0x21
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_free = USB_CDC_RX_BUFFER_SIZE
No documentation found
var byte cdc_line_status = 0x00
No documentation found
const byte USB_REQ_SEND_BREAK = 0x23
No documentation found
const byte USB_REQ_SET_LINE_CODING = 0x20
No documentation found
var volatile byte cdc_tx_wr=0
No documentation found
var volatile byte cdc_rx_rd = 0
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
No documentation found
var volatile byte cdc_line_coding[7]
No documentation found
const byte USB_REQ_SET_CONTROL_LINE_STATE = 0x22
No documentation found
const byte USB_REQ_GET_ENCAPSULATED_RESPONSE = 0x01
No documentation found
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
No documentation found
var volatile dword cdc_line_coding_dte_rate at cdc_line_coding[0]
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 bit last_packet_is_full = false
No documentation found
const byte USB_REQ_SEND_ENCAPSULATED_COMMAND = 0x00
No documentation found
var volatile byte cdc_tx_rd=0
No documentation found
const byte USB_REQ_CLEAR_COMM_FEATURE = 0x04
No documentation found
var volatile byte cdc_rx_wr = 0
No documentation found
var volatile byte cdc_line_coding_data_bits at cdc_line_coding[6] -- 5,6,7,8 or 16 bits
No documentation found
const byte USB_REQ_GET_LINE_CODING = 0x21
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 USB_KEYBOARD_KEY_COMMA = 0x85
const USB_KEYBOARD_KEY_K = 0x0E
const USB_KEYBOARD_KEY_S = 0x16
const byte USB_EP1_IN_SIZE = 8
const USB_KEYBOARD_KEY_I = 0x0C
const byte USB_EP2_IN_SIZE = 8
const USB_KEYBOARD_KEY_LEFT_CONTROL = 0xE0
const USB_KEYBOARD_KEY_4 = 0x21
const USB_KEYBOARD_KEY_Q = 0x14
const byte USB_STRING0[] =
const USB_KEYBOARD_KEY_X = 0x1B
const byte USB_HID_ENDPOINT = 0x01
const USB_KEYBOARD_KEY_F10 = 0x43
const word USB_EP1_OUT_ADDR = ( USB_EP0_IN_ADDR + USB_EP0_IN_SIZE )
const USB_KEYBOARD_MKEY_RIGHT_SHIFT = 0b_00100000
const USB_KEYBOARD_KEY_Y = 0x1C
const USB_KEYBOARD_KEY_SPACE = 0x2C
const word USB_EP2_IN_ADDR = 0x0000
const USB_KEYBOARD_KEY_L = 0x0F
const byte USB_HID_REPORT1[]=
const USB_KEYBOARD_KEY_F12 = 0x45
const byte USB_HCR_GET_PROTOCOL = 0x03
var byte _usb_keyboard_led_status = 0x00
const byte USB_EP2_OUT_SIZE = 8
var volatile bit _usb_keyboard_led_caps_lock at _usb_keyboard_led_status:1
const USB_KEYBOARD_KEY_SCROLL_LOCK = 0x84
const USB_KEYBOARD_KEY_6 = 0x23
const USB_KEYBOARD_KEY_EQUAL_SIGN = 0x86
const byte USB_EP3_OUT_SIZE = 8
const bit USB_EP1 = 1
const USB_KEYBOARD_KEY_E = 0x08
const word USB_EP2_OUT_ADDR = 0x0000
const USB_KEYBOARD_KEY_R = 0x15
const USB_KEYBOARD_KEY_A = 0x04
const USB_KEYBOARD_KEY_O = 0x12
const USB_CONFIGURATION_DESCRIPTOR_SIZE = 0x09 + 0x09 + 0x09 + 0x07
const USB_KEYBOARD_KEY_T = 0x17
const USB_KEYBOARD_KEY_8 = 0x25
var volatile bit _usb_keyboard_led_kana at _usb_keyboard_led_status:3
const USB_KEYBOARD_KEY_F4 = 0x3D
const USB_KEYBOARD_KEY_PAGEUP = 0x4B
const USB_KEYBOARD_MKEY_LEFT_CTRL = 0b_00000001
const USB_KEYBOARD_KEY_LEFT_ALT = 0xE2
const USB_KEYBOARD_KEY_0 = 0x27
const USB_KEYBOARD_KEY_C = 0x06
const byte USB_EP0_IN_SIZE = 8
const word USB_EP3_OUT_ADDR = 0x0000
const USB_KEYBOARD_MKEY_RIGHT_GUI = 0b_10000000
var volatile bit _usb_hid_can_tx = true
const byte USB_HCR_SET_REPORT = 0x09
const word USB_EP0_IN_ADDR = ( USB_EP0_OUT_ADDR + USB_EP0_OUT_SIZE )
const USB_KEYBOARD_KEY_1 = 0x1E
const USB_KEYBOARD_KEY_5 = 0x22
const word USB_EP3_IN_ADDR = 0x0000
const byte USB_HCR_GET_IDLE = 0x02
const USB_KEYBOARD_KEY_CAPS_LOCK = 0x82
const USB_KEYBOARD_KEY_N = 0x11
const USB_KEYBOARD_KEY_M = 0x10
const USB_KEYBOARD_MKEY_LEFT_GUI = 0b_00001000
const byte USB_EP0_OUT_SIZE = 8
const USB_KEYBOARD_MKEY_RIGHT_CTRL = 0b_00010000
const USB_KEYBOARD_KEY_J = 0x0D
const USB_KEYBOARD_KEY_P = 0x13
const byte USB_HCR_SET_PROTOCOL = 0x0B
const USB_KEYBOARD_KEY_RIGHT_GUI = 0xE7
const byte USB_HCR_GET_REPORT = 0x01
const byte USB_DEVICE_DESCRIPTOR[USB_DEVICE_DESCRIPTOR_SIZE] = {
const USB_KEYBOARD_KEY_F6 = 0x3F
const byte USB_HID_REQ_PHYSDISCR = 0x23
const USB_KEYBOARD_KEY_7 = 0x24
const USB_KEYBOARD_KEY_LEFT_GUI = 0xE3
const USB_KEYBOARD_KEY_G = 0x0A
const USB_KEYBOARD_KEY_RIGHT_SHIFT = 0xE5
const USB_KEYBOARD_KEY_F1 = 0x3A
const USB_KEYBOARD_KEY_V = 0x19
const byte USB_CONFIGURATION_DESCRIPTOR[ USB_CONFIGURATION_DESCRIPTOR_SIZE ]=
const byte USB_HCR_SET_IDLE = 0x0A
const USB_KEYBOARD_KEY_9 = 0x26
const byte USB_EP1_OUT_SIZE = 8
var volatile byte usb_ep1in_buf[ 8 ] at USB_EP1_IN_ADDR
const USB_KEYBOARD_KEY_F9 = 0x42
const USB_KEYBOARD_KEY_F2 = 0x3B
const USB_KEYBOARD_KEY_LEFT_SHIFT = 0xE1
const USB_KEYBOARD_KEY_F7 = 0x40
const USB_KEYBOARD_KEY_W = 0x1A
const USB_KEYBOARD_KEY_Z = 0x1D
const USB_KEYBOARD_KEY_F8 = 0x41
const USB_KEYBOARD_KEY_F = 0x09
var volatile bit _usb_keyboard_led_num_lock at _usb_keyboard_led_status:0
const bit USB_EP2 = 0
const USB_KEYBOARD_KEY_RIGHT_CONTROL = 0xE4
const USB_KEYBOARD_KEY_F11 = 0x44
const USB_KEYBOARD_KEY_H = 0x0B
const USB_KEYBOARD_KEY_PAGEDOWN = 0x4E
const USB_KEYBOARD_MKEY_RIGHT_ALT = 0b_01000000
const USB_KEYBOARD_KEY_2 = 0x1F
const USB_KEYBOARD_MKEY_LEFT_SHIFT = 0b_00000010
const USB_KEYBOARD_MKEY_LEFT_ALT = 0b_00000100
const USB_KEYBOARD_KEY_RIGHT_ALT = 0xE6
const word USB_EP1_IN_ADDR = ( USB_EP1_OUT_ADDR + USB_EP1_OUT_SIZE )
const USB_KEYBOARD_KEY_NUM_LOCK = 0x83
const byte USB_HID_REQ_REPORT = 0x22
const USB_KEYBOARD_KEY_U = 0x18
var volatile bit _usb_keyboard_led_compose at _usb_keyboard_led_status:2
const USB_KEYBOARD_KEY_F5 = 0x3E
const USB_KEYBOARD_KEY_F3 = 0x3C
const byte USB_EP3_IN_SIZE = 8
var byte usb_kbd_report[8]
const USB_KEYBOARD_KEY_D = 0x07
const USB_KEYBOARD_KEY_3 = 0x20
const USB_KEYBOARD_KEY_B = 0x05
const byte USB_HID_REQ_HID = 0x21
const word USB_EP0_OUT_ADDR = ( USB_BASE_ADDRESS + 0x0010 )
const USB_KEYBOARD_KEY_NONE = 0x00
const bit USB_EP0 = 1
const bit USB_EP3 = 0
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 USB_KEYBOARD_KEY_COMMA = 0x85
No documentation found
const USB_KEYBOARD_KEY_K = 0x0E
No documentation found
const USB_KEYBOARD_KEY_S = 0x16
No documentation found
const byte USB_EP1_IN_SIZE = 8
No documentation found
const USB_KEYBOARD_KEY_I = 0x0C
No documentation found
const byte USB_EP2_IN_SIZE = 8
No documentation found
const USB_KEYBOARD_KEY_LEFT_CONTROL = 0xE0
No documentation found
const USB_KEYBOARD_KEY_4 = 0x21
No documentation found
const USB_KEYBOARD_KEY_Q = 0x14
No documentation found
const byte USB_STRING0[] =
No documentation found
const USB_KEYBOARD_KEY_X = 0x1B
No documentation found
const byte USB_HID_ENDPOINT = 0x01
No documentation found
const USB_KEYBOARD_KEY_F10 = 0x43
No documentation found
const word USB_EP1_OUT_ADDR = ( USB_EP0_IN_ADDR + USB_EP0_IN_SIZE )
No documentation found
const USB_KEYBOARD_MKEY_RIGHT_SHIFT = 0b_00100000
No documentation found
const USB_KEYBOARD_KEY_Y = 0x1C
No documentation found
const USB_KEYBOARD_KEY_SPACE = 0x2C
No documentation found
const word USB_EP2_IN_ADDR = 0x0000
No documentation found
const USB_KEYBOARD_KEY_L = 0x0F
No documentation found
const byte USB_HID_REPORT1[]=
No documentation found
const USB_KEYBOARD_KEY_F12 = 0x45
No documentation found
const byte USB_HCR_GET_PROTOCOL = 0x03
No documentation found
var byte _usb_keyboard_led_status = 0x00
No documentation found
const byte USB_EP2_OUT_SIZE = 8
No documentation found
var volatile bit _usb_keyboard_led_caps_lock at _usb_keyboard_led_status:1
No documentation found
const USB_KEYBOARD_KEY_SCROLL_LOCK = 0x84
No documentation found
const USB_KEYBOARD_KEY_6 = 0x23
No documentation found
const USB_KEYBOARD_KEY_EQUAL_SIGN = 0x86
No documentation found
const byte USB_EP3_OUT_SIZE = 8
No documentation found
const bit USB_EP1 = 1
No documentation found
const USB_KEYBOARD_KEY_E = 0x08
No documentation found
const word USB_EP2_OUT_ADDR = 0x0000
No documentation found
const USB_KEYBOARD_KEY_R = 0x15
No documentation found
const USB_KEYBOARD_KEY_A = 0x04
No documentation found
const USB_KEYBOARD_KEY_O = 0x12
No documentation found
const USB_CONFIGURATION_DESCRIPTOR_SIZE = 0x09 + 0x09 + 0x09 + 0x07
No documentation found
const USB_KEYBOARD_KEY_T = 0x17
No documentation found
const USB_KEYBOARD_KEY_8 = 0x25
No documentation found
var volatile bit _usb_keyboard_led_kana at _usb_keyboard_led_status:3
No documentation found
const USB_KEYBOARD_KEY_F4 = 0x3D
No documentation found
const USB_KEYBOARD_KEY_PAGEUP = 0x4B
No documentation found
const USB_KEYBOARD_MKEY_LEFT_CTRL = 0b_00000001
List with modifier keyboard code definitions
const USB_KEYBOARD_KEY_LEFT_ALT = 0xE2
No documentation found
const USB_KEYBOARD_KEY_0 = 0x27
No documentation found
const USB_KEYBOARD_KEY_C = 0x06
No documentation found
const byte USB_EP0_IN_SIZE = 8
No documentation found
const word USB_EP3_OUT_ADDR = 0x0000
No documentation found
const USB_KEYBOARD_MKEY_RIGHT_GUI = 0b_10000000
No documentation found
var volatile bit _usb_hid_can_tx = true
No documentation found
const byte USB_HCR_SET_REPORT = 0x09
No documentation found
const word USB_EP0_IN_ADDR = ( USB_EP0_OUT_ADDR + USB_EP0_OUT_SIZE )
No documentation found
const USB_KEYBOARD_KEY_1 = 0x1E
No documentation found
const USB_KEYBOARD_KEY_5 = 0x22
No documentation found
const word USB_EP3_IN_ADDR = 0x0000
No documentation found
const byte USB_HCR_GET_IDLE = 0x02
No documentation found
const USB_KEYBOARD_KEY_CAPS_LOCK = 0x82
No documentation found
const USB_KEYBOARD_KEY_N = 0x11
No documentation found
const USB_KEYBOARD_KEY_M = 0x10
No documentation found
const USB_KEYBOARD_MKEY_LEFT_GUI = 0b_00001000
No documentation found
const byte USB_EP0_OUT_SIZE = 8
No documentation found
const USB_KEYBOARD_MKEY_RIGHT_CTRL = 0b_00010000
No documentation found
const USB_KEYBOARD_KEY_J = 0x0D
No documentation found
const USB_KEYBOARD_KEY_P = 0x13
No documentation found
const byte USB_HCR_SET_PROTOCOL = 0x0B
No documentation found
const USB_KEYBOARD_KEY_RIGHT_GUI = 0xE7
No documentation found
const byte USB_HCR_GET_REPORT = 0x01
No documentation found
const byte USB_DEVICE_DESCRIPTOR[USB_DEVICE_DESCRIPTOR_SIZE] = {
No documentation found
const USB_KEYBOARD_KEY_F6 = 0x3F
No documentation found
const byte USB_HID_REQ_PHYSDISCR = 0x23
No documentation found
const USB_KEYBOARD_KEY_7 = 0x24
No documentation found
const USB_KEYBOARD_KEY_LEFT_GUI = 0xE3
No documentation found
const USB_KEYBOARD_KEY_G = 0x0A
No documentation found
const USB_KEYBOARD_KEY_RIGHT_SHIFT = 0xE5
No documentation found
const USB_KEYBOARD_KEY_F1 = 0x3A
No documentation found
const USB_KEYBOARD_KEY_V = 0x19
No documentation found
const byte USB_CONFIGURATION_DESCRIPTOR[ USB_CONFIGURATION_DESCRIPTOR_SIZE ]=
No documentation found
const byte USB_HCR_SET_IDLE = 0x0A
No documentation found
const USB_KEYBOARD_KEY_9 = 0x26
No documentation found
const byte USB_EP1_OUT_SIZE = 8
No documentation found
var volatile byte usb_ep1in_buf[ 8 ] at USB_EP1_IN_ADDR
No documentation found
const USB_KEYBOARD_KEY_F9 = 0x42
No documentation found
const USB_KEYBOARD_KEY_F2 = 0x3B
No documentation found
const USB_KEYBOARD_KEY_LEFT_SHIFT = 0xE1
No documentation found
const USB_KEYBOARD_KEY_F7 = 0x40
No documentation found
const USB_KEYBOARD_KEY_W = 0x1A
No documentation found
const USB_KEYBOARD_KEY_Z = 0x1D
No documentation found
const USB_KEYBOARD_KEY_F8 = 0x41
No documentation found
const USB_KEYBOARD_KEY_F = 0x09
No documentation found
var volatile bit _usb_keyboard_led_num_lock at _usb_keyboard_led_status:0
No documentation found
const bit USB_EP2 = 0
No documentation found
const USB_KEYBOARD_KEY_RIGHT_CONTROL = 0xE4
No documentation found
const USB_KEYBOARD_KEY_F11 = 0x44
No documentation found
const USB_KEYBOARD_KEY_H = 0x0B
No documentation found
const USB_KEYBOARD_KEY_PAGEDOWN = 0x4E
No documentation found
const USB_KEYBOARD_MKEY_RIGHT_ALT = 0b_01000000
No documentation found
const USB_KEYBOARD_KEY_2 = 0x1F
No documentation found
const USB_KEYBOARD_MKEY_LEFT_SHIFT = 0b_00000010
No documentation found
const USB_KEYBOARD_MKEY_LEFT_ALT = 0b_00000100
No documentation found
const USB_KEYBOARD_KEY_RIGHT_ALT = 0xE6
No documentation found
const word USB_EP1_IN_ADDR = ( USB_EP1_OUT_ADDR + USB_EP1_OUT_SIZE )
No documentation found
const USB_KEYBOARD_KEY_NUM_LOCK = 0x83
No documentation found
const byte USB_HID_REQ_REPORT = 0x22
No documentation found
const USB_KEYBOARD_KEY_U = 0x18
No documentation found
var volatile bit _usb_keyboard_led_compose at _usb_keyboard_led_status:2
No documentation found
const USB_KEYBOARD_KEY_F5 = 0x3E
No documentation found
const USB_KEYBOARD_KEY_F3 = 0x3C
No documentation found
const byte USB_EP3_IN_SIZE = 8
No documentation found
var byte usb_kbd_report[8]
No documentation found
const USB_KEYBOARD_KEY_D = 0x07
No documentation found
const USB_KEYBOARD_KEY_3 = 0x20
No documentation found
const USB_KEYBOARD_KEY_B = 0x05
No documentation found
const byte USB_HID_REQ_HID = 0x21
No documentation found
const word USB_EP0_OUT_ADDR = ( USB_BASE_ADDRESS + 0x0010 )
No documentation found
const USB_KEYBOARD_KEY_NONE = 0x00
List with keyboard code definitions, note keycodes are not equivalent with the ASCII codes
const bit USB_EP0 = 1
No documentation found
const bit USB_EP3 = 0
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 byte USB_DSC_FN_ACM = 0x02 -- ACM - Abstract Control Management
const word USB_EP1_IN_ADDR = (USB_EP1_OUT_ADDR + USB_EP1_OUT_SIZE )
const byte USB_DSC_FN_USB_TERMINAL = 0x09
const byte USB_DSC_FN_RPT_CAPABILITIES = 0x05
const byte USB_EP1_OUT_SIZE = 8
var volatile byte usb_cdc_eptx_buffer[USB_EP3_IN_SIZE] at USB_EP3_IN_ADDR
const byte USB_DSC_FN_TELEPHONE_RINGER = 0x04
const byte USB_DSC_FN_UNION = 0x06
const byte USB_EP1_IN_SIZE = 8
const byte USB_EP2_IN_SIZE = 8
const byte USB_DSC_FN_TEL_OP_MODES = 0x08
const word USB_EP1_OUT_ADDR = (USB_BASE_ADDRESS + 0x0030 )
var volatile byte usb_ep1in_buf[ USB_EP1_IN_SIZE ] at USB_EP1_IN_ADDR
const byte USB_EP3_OUT_SIZE = 8
const byte USB_STRING1[0x36] =
const byte USB_DSC_FN_CALL_MGT = 0x01
const word USB_SERIAL_PRODUCT_ID = 0x000A
const byte USB_DSC_FN_COUNTRY_SELECTION = 0x07
const byte USB_STRING0[] =
const word USB_EP0_OUT_ADDR = (USB_BASE_ADDRESS + 0x0020 )
const byte USB_EP3_IN_SIZE = 8
const bit USB_EP3 = 1
const byte USB_DEVICE_DESCRIPTOR[USB_DEVICE_DESCRIPTOR_SIZE] = {
const word USB_SERIAL_VENDOR_ID = 0x04D8
const byte USB_CDC_NO_PROTOCOL = 0x00 -- No class specific protocol required
const word USB_EP2_OUT_ADDR = (USB_BASE_ADDRESS + 0x0040 )
var volatile byte usb_ep3out_buf[ USB_EP3_OUT_SIZE ] at USB_EP3_OUT_ADDR
const byte USB_EP0_IN_SIZE = 8
const word USB_CDC_BULK_OUT_EP_ADDR = USB_EP3_OUT_ADDR
const byte USB_CDC_DATA_ENDPOINT = 3
var volatile byte usb_ep1out_buf[ USB_EP1_OUT_SIZE ] at USB_EP1_OUT_ADDR
const byte USB_DSC_FN_DLM = 0x03 -- DLM - Direct Line Managment
const bit USB_EP2 = 1
const bit USB_EP1 = 1
const byte USB_STRING2[30] =
const byte USB_CONFIGURATION_DESCRIPTOR[ USB_CONFIGURATION_DESCRIPTOR_SIZE ]=
const byte USB_CDC_BULK_IN_EP_SIZE = USB_EP3_IN_SIZE
const byte USB_CDC_RX_BUFFER_SIZE = 0x10
const byte USB_EP0_OUT_SIZE = 8
const word USB_EP2_IN_ADDR = (USB_EP2_OUT_ADDR + USB_EP2_OUT_SIZE )
var volatile byte usb_ep3in_buf[ USB_EP3_IN_SIZE ] at USB_EP3_IN_ADDR
const word USB_EP3_OUT_ADDR = (USB_BASE_ADDRESS + 0x0050 )
const byte USB_CDC_DATA_INTF = 0x0A
const byte USB_CS_INTERFACE = 0x24
const byte USB_EP2_OUT_SIZE = 8
const USB_CONFIGURATION_DESCRIPTOR_SIZE = 0x09 + 0x09 + 0x05 + 0x04 + 0x05 + 0x05 + 0x07 + 0x09 + 0x07 + 0x07
const byte USB_DSC_FN_HEADER = 0x00
var volatile byte usb_ep2in_buf[ USB_EP2_IN_SIZE ] at USB_EP2_IN_ADDR
var volatile byte usb_ep0in_buf[ USB_EP0_IN_SIZE ] at USB_EP0_IN_ADDR
const word USB_EP0_IN_ADDR = (USB_EP0_OUT_ADDR + USB_EP0_OUT_SIZE )
const byte USB_CDC_INT_EP_SIZE = 8
const byte USB_CDC_COMM_INTF_ID = 0x00
var volatile byte usb_ep0out_buf[ USB_EP0_OUT_SIZE ] at USB_EP0_OUT_ADDR
const word USB_EP3_IN_ADDR = (USB_EP3_OUT_ADDR + USB_EP3_OUT_SIZE )
const word USB_CDC_BULK_IN_EP_ADDR = USB_EP3_IN_ADDR
const byte USB_CDC_DATA_INTF_ID = 0x01
var volatile byte usb_ep2out_buf[ USB_EP2_OUT_SIZE ] at USB_EP2_OUT_ADDR
const byte USB_CS_ENDPOINT = 0x25
const byte USB_DCS_INTERFACE = 0x04
const byte USB_CDC_TX_BUFFER_SIZE = 0x20
var volatile byte usb_cdc_eprx_buffer[USB_EP3_OUT_SIZE] at USB_EP3_OUT_ADDR
const bit USB_EP0 = 1
const byte USB_CDC_BULK_OUT_EP_SIZE = USB_EP3_OUT_SIZE
usb_serial_data'put(byte in data)
usb_serial_init()
usb_serial_flush()
usb_serial_write(byte in data)
const byte USB_DSC_FN_ACM = 0x02 -- ACM - Abstract Control Management
No documentation found
const word USB_EP1_IN_ADDR = (USB_EP1_OUT_ADDR + USB_EP1_OUT_SIZE )
No documentation found
const byte USB_DSC_FN_USB_TERMINAL = 0x09
No documentation found
const byte USB_DSC_FN_RPT_CAPABILITIES = 0x05
No documentation found
const byte USB_EP1_OUT_SIZE = 8
No documentation found
var volatile byte usb_cdc_eptx_buffer[USB_EP3_IN_SIZE] at USB_EP3_IN_ADDR
No documentation found
const byte USB_DSC_FN_TELEPHONE_RINGER = 0x04
No documentation found
const byte USB_DSC_FN_UNION = 0x06
No documentation found
const byte USB_EP1_IN_SIZE = 8
No documentation found
const byte USB_EP2_IN_SIZE = 8
No documentation found
const byte USB_DSC_FN_TEL_OP_MODES = 0x08
No documentation found
const word USB_EP1_OUT_ADDR = (USB_BASE_ADDRESS + 0x0030 )
No documentation found
var volatile byte usb_ep1in_buf[ USB_EP1_IN_SIZE ] at USB_EP1_IN_ADDR
No documentation found
const byte USB_EP3_OUT_SIZE = 8
No documentation found
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).
const byte USB_DSC_FN_CALL_MGT = 0x01
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_COUNTRY_SELECTION = 0x07
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 word USB_EP0_OUT_ADDR = (USB_BASE_ADDRESS + 0x0020 )
No documentation found
const byte USB_EP3_IN_SIZE = 8
No documentation found
const bit USB_EP3 = 1
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_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_CDC_NO_PROTOCOL = 0x00 -- No class specific protocol required
No documentation found
const word USB_EP2_OUT_ADDR = (USB_BASE_ADDRESS + 0x0040 )
No documentation found
var volatile byte usb_ep3out_buf[ USB_EP3_OUT_SIZE ] at USB_EP3_OUT_ADDR
No documentation found
const byte USB_EP0_IN_SIZE = 8
No documentation found
const word USB_CDC_BULK_OUT_EP_ADDR = USB_EP3_OUT_ADDR
No documentation found
const byte USB_CDC_DATA_ENDPOINT = 3
No documentation found
var volatile byte usb_ep1out_buf[ USB_EP1_OUT_SIZE ] at USB_EP1_OUT_ADDR
No documentation found
const byte USB_DSC_FN_DLM = 0x03 -- DLM - Direct Line Managment
No documentation found
const bit USB_EP2 = 1
No documentation found
const bit USB_EP1 = 1
No documentation found
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).
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_CDC_BULK_IN_EP_SIZE = USB_EP3_IN_SIZE
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 byte USB_EP0_OUT_SIZE = 8
No documentation found
const word USB_EP2_IN_ADDR = (USB_EP2_OUT_ADDR + USB_EP2_OUT_SIZE )
No documentation found
var volatile byte usb_ep3in_buf[ USB_EP3_IN_SIZE ] at USB_EP3_IN_ADDR
No documentation found
const word USB_EP3_OUT_ADDR = (USB_BASE_ADDRESS + 0x0050 )
No documentation found
const byte USB_CDC_DATA_INTF = 0x0A
No documentation found
const byte USB_CS_INTERFACE = 0x24
No documentation found
const byte USB_EP2_OUT_SIZE = 8
No documentation found
const USB_CONFIGURATION_DESCRIPTOR_SIZE = 0x09 + 0x09 + 0x05 + 0x04 + 0x05 + 0x05 + 0x07 + 0x09 + 0x07 + 0x07
No documentation found
const byte USB_DSC_FN_HEADER = 0x00
No documentation found
var volatile byte usb_ep2in_buf[ USB_EP2_IN_SIZE ] at USB_EP2_IN_ADDR
No documentation found
var volatile byte usb_ep0in_buf[ USB_EP0_IN_SIZE ] at USB_EP0_IN_ADDR
No documentation found
const word USB_EP0_IN_ADDR = (USB_EP0_OUT_ADDR + USB_EP0_OUT_SIZE )
No documentation found
const byte USB_CDC_INT_EP_SIZE = 8
set the size of the interrupt interface
const byte USB_CDC_COMM_INTF_ID = 0x00
set the communication interface ID
var volatile byte usb_ep0out_buf[ USB_EP0_OUT_SIZE ] at USB_EP0_OUT_ADDR
No documentation found
const word USB_EP3_IN_ADDR = (USB_EP3_OUT_ADDR + USB_EP3_OUT_SIZE )
No documentation found
const word USB_CDC_BULK_IN_EP_ADDR = USB_EP3_IN_ADDR
No documentation found
const byte USB_CDC_DATA_INTF_ID = 0x01
set the interrupt interface ID
var volatile byte usb_ep2out_buf[ USB_EP2_OUT_SIZE ] at USB_EP2_OUT_ADDR
No documentation found
const byte USB_CS_ENDPOINT = 0x25
No documentation found
const byte USB_DCS_INTERFACE = 0x04
No documentation found
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
var volatile byte usb_cdc_eprx_buffer[USB_EP3_OUT_SIZE] at USB_EP3_OUT_ADDR
No documentation found
const bit USB_EP0 = 1
No documentation found
const byte USB_CDC_BULK_OUT_EP_SIZE = USB_EP3_OUT_SIZE
No documentation found
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_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_usb_serial.jal |