MIOS Functions Reference (C Version)

Click here for ASM version

- Class: MIOS_MIDI

- Class: MIOS_MPROC

- Class: MIOS_AIN

- Class: MIOS_MF

- Class: MIOS_DIN

- Class: MIOS_DOUT

- Class: MIOS_ENC

- Class: MIOS_SRIO

- Class: MIOS_LCD

- Class: MIOS_CLCD

- Class: MIOS_GLCD

- Class: MIOS_EEPROM

- Class: MIOS_FLASH

- Class: MIOS_BANKSTICK

- Class: MIOS_IIC

- Class: MIOS_TIMER

- Class: MIOS_HLP

- Class: MIOS

- Class: USER

MIOS_MIDI_BeginStream |
C_DECLARATION |
void MIOS_MIDI_BeginStream(void) |
DESCRIPTION |
use this function before a new MIDI event or stream should be sent. Necessary for a correct function of the MIDIbox Link feature! |
C_IN |
- |
C_OUT |
- |
C_EXAMPLE |
// send the MIDI event B0 07 7F
MIOS_MIDI_BeginStream();
MIOS_MIDI_TxBufferPut(0xb0);
MIOS_MIDI_TxBufferPut(0x07);
MIOS_MIDI_TxBufferPut(0x7f);
MIOS_MIDI_EndStream();
|
Back to the top |
MIOS_MIDI_DeviceIDAutoSet |
C_DECLARATION |
void MIOS_MIDI_DeviceIDAutoSet(void) |
DESCRIPTION |
derives the MIDI device ID from the PIC ID header |
C_IN |
- |
C_OUT |
- |
C_EXAMPLE |
// set device ID to the specified value in the PIC ID header
MIOS_MIDI_DeviceIDAutoSet();
|
Back to the top |
MIOS_MIDI_DeviceIDGet |
C_DECLARATION |
unsigned char MIOS_MIDI_DeviceIDGet(void) |
DESCRIPTION |
returns the MIDI device ID |
C_IN |
- |
C_OUT |
device number |
C_EXAMPLE |
// print device ID on display
MIOS_LCD_PrintHex2(MIOS_MIDI_DeviceIDGet());
|
Back to the top |
MIOS_MIDI_DeviceIDSet |
C_DECLARATION |
void MIOS_MIDI_DeviceIDSet(unsigned char device_id) |
DESCRIPTION |
sets the MIDI device ID. Should be a unique number in a MIDI chain. Normaly this ID is derived from the PIC ID header with the MIOS_MIDI_DeviceIDAutoSet function |
C_IN |
device number in <device_id> |
C_OUT |
- |
C_EXAMPLE |
;; change device ID
MIOS_MIDI_DeviceIDSet(0x03);
|
Back to the top |
MIOS_MIDI_EndStream |
C_DECLARATION |
void MIOS_MIDI_EndStream(void) |
DESCRIPTION |
use this function after a MIDI event or stream has been sent. Necessary for a correct function of the MIDIbox Link feature! |
C_IN |
- |
C_OUT |
- |
C_EXAMPLE |
// send the MIDI event 90 36 7F
MIOS_MIDI_BeginStream();
MIOS_MIDI_TxBufferPut(0x90);
MIOS_MIDI_TxBufferPut(0x36);
MIOS_MIDI_TxBufferPut(0x7f);
MIOS_MIDI_EndStream();
|
Back to the top |
MIOS_MIDI_Init |
C_DECLARATION |
void MIOS_MIDI_Init(void) |
DESCRIPTION |
initialises the MIDI interface: baudrate will be set depending on To-Host/MIDI option, Rx and Tx buffer will be emptied |
C_IN |
- |
C_OUT |
- |
Back to the top |
MIOS_MIDI_InterfaceAutoSet |
C_DECLARATION |
void MIOS_MIDI_InterfaceAutoSet(void) |
DESCRIPTION |
derives the MIDI interface type and the MBHP_IIC_MIDI module address from the PIC ID header. To-Host flag: ID Byte 6, Bit 0 MBHP_IIC_MIDI module address: ID Byte 5 If the slave address is != 0x00 and != 0xff, it will be taken as default MIDI Out by MIOS |
C_IN |
- |
C_OUT |
- |
C_EXAMPLE |
// set MIDI interface to the specified type in the PIC ID header
MIOS_MIDI_InterfaceAutoSet();
|
Back to the top |
MIOS_MIDI_InterfaceGet |
C_DECLARATION |
unsigned char MIOS_MIDI_InterfaceGet(void) |
DESCRIPTION |
returns the current MIDI interface type following Interface types are provided: 0x00: MIOS_MIDI_INTERFACE_COMMON (common MIDI interface, 31250 baud) 0x01: MIOS_MIDI_INTERFACE_TO_HOST (MIDIbox-to-COM interface, RS232, 38400 baud) >= 0x02: MBHP_IIC_MIDI module address |
C_IN |
- |
C_OUT |
interface type |
C_EXAMPLE |
// get current interface type and branch depending on setting
switch( MIOS_MIDI_InterfaceGet() ) {
case MIOS_MIDI_INTERFACE_COMMON:
// do this...
break;
case MIOS_MIDI_INTERFACE_TO_HOST:
// do that...
break;
default:
// IIC slave selected...
}
|
Back to the top |
MIOS_MIDI_InterfaceSet |
C_DECLARATION |
void MIOS_MIDI_InterfaceSet(unsigned char interface) |
DESCRIPTION |
this function has two purposes: If the interface number is 0x00 or 0x01, the internal USART will be selected, and a baudrate of either 31250 or 38400 baud will be configured: 0x00: MIOS_MIDI_INTERFACE_COMMON (common MIDI interface, 31250 baud) 0x01: MIOS_MIDI_INTERFACE_TO_HOST (MIDIbox-to-COM interface, RS232, 38400 baud) With values >= 0x02 a MBHP_IIC_MIDI module will be selected for outgoing MIDI messages (which are sent with MIOS_MIDI_TxBufferPut) Incoming messages are still handled with the internal USART! If data should be received from a MBHP_IIC_MIDI module, please use the appr. functions of the software package which is provided together with the module. Note that the MIOS_MIDI_InterfaceAutoSet function allows you to derive the MIDI interface type and the IIC slave address from the PIC ID header!
|
C_IN |
interface type in <interface> |
C_OUT |
- |
C_EXAMPLE |
// send MIDI clock over internal MIDI Out with normal baudrate
MIOS_MIDI_InterfaceSet(MIOS_MIDI_INTERFACE_COMMON);
MIOS_MIDI_TxBufferPut(0xf8);
// send MIDI clock over MBHP_IIC_MIDI with address 0x10
MIOS_MIDI_InterfaceSet(0x10);
MIOS_MIDI_TxBufferPut(0xf8);
// switch back to the default interface
MIOS_MIDI_InterfaceAutoSet();
|
Back to the top |
MIOS_MIDI_MergerGet |
C_DECLARATION |
unsigned char MIOS_MIDI_MergerGet(void) |
DESCRIPTION |
returns configuration of integrated MIDI merger: 0x00: MIOS_MIDI_MERGER_DISABLED (merger disabled) 0x01: MIOS_MIDI_MERGER_ENABLED (merger enabled) 0x02: MIOS_MIDI_MERGER_MBLINK_EP (MIDIbox Link End Point) 0x03: MIOS_MIDI_MERGER_MBLINK_FP (MIDIbox Link Forwarding Point) |
C_IN |
- |
C_OUT |
merger function ID |
C_EXAMPLE |
// get current merger configuration and branch depending on setting
switch( MIOS_MIDI_MergerGet() ) {
case MIOS_MIDI_MERGER_ENABLED:
// do this...
break;
case MIOS_MIDI_MERGER_MBLINK_EP:
// do this...
break;
case MIOS_MIDI_MERGER_MBLINK_FP:
// do this...
break;
default: // MIOS_MIDI_MERGER_DISABLED:
// do that...
}
|
Back to the top |
MIOS_MIDI_MergerSet |
C_DECLARATION |
void MIOS_MIDI_MergerSet(unsigned char mode) |
DESCRIPTION |
configures the integrated MIDI merger following Merger IDs are provided: 0x00: MIOS_MIDI_MERGER_DISABLED (merger disabled) 0x01: MIOS_MIDI_MERGER_ENABLED (merger enabled) 0x02: MIOS_MIDI_MERGER_MBLINK_EP (MIDIbox Link End Point) 0x03: MIOS_MIDI_MERGER_MBLINK_FP (MIDIbox Link Forwarding Point) |
C_IN |
merger function ID in <mode> |
C_EXAMPLE |
// configure the MIDIbox as MIDIbox Link End Point
// (means: merger enabled only for events which has
// been generated by another MIDIbox which is configured
// as MIDIbox Link Forwarding Point)
MIOS_MIDI_MergerSet(MIOS_MIDI_MERGER_MBLINK_EP);
|
Back to the top |
MIOS_MIDI_RxBufferFree |
C_DECLARATION |
unsigned char MIOS_MIDI_RxBufferFree(void) |
DESCRIPTION |
returns number of free bytes in receive buffer |
C_IN |
- |
C_OUT |
number of free bytes |
NOTE |
this function is for internal use within MIOS only! Received bytes will be notified by the MPROC hooks! |
C_EXAMPLE |
// put a MIDI byte into the Rx Buffer if it isn't full
if( MIOS_MIDI_RxBufferFree() ) {
MIOS_MIDI_RxBufferPut(0xf8); // MIDI Clock
}
|
Back to the top |
MIOS_MIDI_RxBufferGet |
C_DECLARATION |
unsigned char MIOS_MIDI_RxBufferGet(void) |
DESCRIPTION |
gets a byte from the receive buffer |
C_IN |
- |
C_OUT |
received byte |
NOTE |
this function is for internal use within MIOS only! Received bytes will be notified by the MPROC hooks! |
C_EXAMPLE |
unsigned char b;
// get a MIDI byte from the Rx Buffer if something has been received
if( MIOS_MIDI_RxBufferUsed() ) {
b = MIOS_MIDI_RxBufferGet();
}
|
Back to the top |
MIOS_MIDI_RxBufferPut |
C_DECLARATION |
void MIOS_MIDI_RxBufferPut(unsigned char b) |
DESCRIPTION |
puts a byte onto the receive buffer |
C_IN |
byte in <b> |
C_OUT |
- |
NOTE |
this function is for internal use within MIOS only! Received bytes will be notified by the MPROC hooks! |
C_EXAMPLE |
// put a MIDI byte into the Rx Buffer if it isn't full
if( MIOS_MIDI_RxBufferFree() ) {
MIOS_MIDI_RxBufferPut(0xf8); // MIDI Clock
}
|
Back to the top |
MIOS_MIDI_RxBufferUsed |
C_DECLARATION |
unsigned char MIOS_MIDI_RxBufferUsed(void) |
DESCRIPTION |
returns number of used bytes in receive buffer |
C_IN |
- |
C_OUT |
number of used bytes |
NOTE |
this function is for internal use within MIOS only! Received bytes will be notified by the MPROC hooks! |
C_EXAMPLE |
// branch if something has been received via MIDI
if( MIOS_MIDI_RxBufferUsed() ) {
// do something...
}
|
Back to the top |
MIOS_MIDI_TxBufferFlush |
C_DECLARATION |
void MIOS_MIDI_TxBufferFlush(void) |
DESCRIPTION |
waits until all MIDI bytes in the Tx buffer have been transmitted |
C_IN |
- |
C_OUT |
- |
C_EXAMPLE |
// wait until buffer is empty, thereafter send a bunch of new bytes
MIOS_MIDI_TxBufferFlush();
MIOS_MIDI_TxBufferPut(0xf0);
// ...
|
Back to the top |
MIOS_MIDI_TxBufferFree |
C_DECLARATION |
unsigned char MIOS_MIDI_TxBufferFree(void) |
DESCRIPTION |
returns number of free bytes in transmit buffer |
C_IN |
- |
C_OUT |
number of free bytes |
NOTE |
this function is for internal use within MIOS only! The MIOS_MIDI_TxBufferPut() function will wait if the buffer is full. |
C_EXAMPLE |
// put a MIDI byte into the Tx Buffer if it isn't full
if( MIOS_MIDI_TxBufferFree() ) {
MIOS_MIDI_TxBufferPut(0xf8);
}
|
Back to the top |
MIOS_MIDI_TxBufferGet |
C_DECLARATION |
unsigned char MIOS_MIDI_TxBufferGet(void) |
DESCRIPTION |
gets a byte from the transmit buffer |
C_IN |
- |
C_OUT |
byte to be transmitted |
NOTE |
this function is for internal use within MIOS only! |
C_EXAMPLE |
unsigned char b;
// get a MIDI byte from the Tx Buffer if new byte is available
if( MIOS_MIDI_TxBufferUsed() ) {
b = MIOS_MIDI_TxBufferGet();
}
|
Back to the top |
MIOS_MIDI_TxBufferPut |
C_DECLARATION |
void MIOS_MIDI_TxBufferPut(unsigned char b) |
DESCRIPTION |
puts a byte onto the transmit buffer. If Tx buffer is full, the function will be suspended until one byte has been transmitted via MIDI. This function redirects outgoing bytes to the MBHP_IIC_MIDI module if it has been selected with the MIOS_MIDI_InterfaceSet or MIOS_MIDI_InterfaceAutoSet function |
C_IN |
byte to be transmitted in <b> |
C_OUT |
- |
C_EXAMPLE |
// put a MIDI byte into the Tx Buffer
MIOS_MIDI_TxBufferPut(0xf8); // MIDI Clock
|
Back to the top |
MIOS_MIDI_TxBufferUsed |
C_DECLARATION |
unsigned char MIOS_MIDI_TxBufferUsed(void) |
DESCRIPTION |
returns number of used bytes in buffer |
C_IN |
- |
C_OUT |
number of used bytes |
NOTE |
this function is for internal use within MIOS only! The MIOS_MIDI_TxBufferPut() function will wait if the buffer is full. |
C_EXAMPLE |
// branch if something has been put into the Tx Buffer
if( MIOS_MIDI_TxBufferUsed() ) {
// got something
}
|
Back to the top |
MIOS_MPROC_MergerDisable |
C_DECLARATION |
void MIOS_MPROC_MergerDisable(void) |
DESCRIPTION |
this function allows you to temporary disable the MIDI merger processing during receiving a new event. It's used by SysEx parsers to prevent the forwarding of SysEx strings, but can also used by the USER_MPROC_NotifyReceivedByte hook to filter other events The merger will be enabled again after a complete MIDI event has been received! |
C_IN |
- |
C_OUT |
- |
Back to the top |
MIOS_MPROC_MergerEnable |
C_DECLARATION |
void MIOS_MPROC_MergerEnable(void) |
DESCRIPTION |
enables MIDI merger processing like specified with MIOS_MIDI_MergerSet |
C_IN |
- |
C_OUT |
- |
Back to the top |
MIOS_MPROC_MergerGet |
C_DECLARATION |
unsigned char MIOS_MPROC_MergerGet(void) |
DESCRIPTION |
returns 1 if merger processing is enabled, 0 if disabled |
C_IN |
- |
C_OUT |
status |
Back to the top |
MIOS_AIN_DeadbandGet |
C_DECLARATION |
unsigned char MIOS_AIN_DeadbandGet(void) |
DESCRIPTION |
returns the difference between last and current pot value which has to be achieved to trigger the "NotifyChange" function |
C_IN |
- |
C_OUT |
diff value |
Back to the top |
MIOS_AIN_DeadbandSet |
C_DECLARATION |
void MIOS_AIN_DeadbandSet(unsigned char deadband) |
DESCRIPTION |
sets the difference between last and current pot value which has to be achieved to trigger the "NotifyChange" function |
C_IN |
deadband value in <deadband> |
C_OUT |
- |
Back to the top |
MIOS_AIN_DynamicPrioGet |
C_DECLARATION |
unsigned char MIOS_AIN_DynamicPrioGet(void) |
DESCRIPTION |
returns the status of the dynamic priority sampling feature. The flag will only be taken into account in multiplexed mode (more than 8 pots connected to the core module via AINX4). If active, the sampling frequency of the two last turned pots will be dynamically increased for a better accuracy. |
C_IN |
- |
C_OUT |
0x00: dynamic priority sampling disabled or non-multiplexed mode active 0x01: dynamic priority sampling enabled (default) |
Back to the top |
MIOS_AIN_DynamicPrioSet |
C_DECLARATION |
void MIOS_AIN_DynamicPrioSet(unsigned char enable) |
DESCRIPTION |
enables or disables the dynamic priority sampling feature. The flag will only be taken into account in multiplexed mode (more than 8 pots connected to the core module via AINX4). If active, the sampling frequency of the two last turned pots will be dynamically increased for a better accuracy. |
C_IN |
0x00: dynamic priority sampling disabled 0x01: dynamic priority sampling enabled (default) |
C_OUT |
- |
Back to the top |
MIOS_AIN_LastPinsGet |
C_DECLARATION |
unsigned char MIOS_AIN_LastPinsGet(void) |
DESCRIPTION |
returns the index of the two pins which have been sampled with a different value at last. In less abstract words: returns the number of the last two turned pots. |
C_IN |
- |
C_OUT |
returned value and MIOS_PARAMETER1: last pin MIOS_PARAMETER2: last but one pin |
Back to the top |
MIOS_AIN_Muxed |
C_DECLARATION |
void MIOS_AIN_Muxed(void) |
DESCRIPTION |
enables the MUX mode (up to 64 pots can be connected via AIN multiplexers |
C_IN |
- |
C_OUT |
- |
Back to the top |
MIOS_AIN_NumberGet |
C_DECLARATION |
unsigned char MIOS_AIN_NumberGet(void) |
DESCRIPTION |
returns number of available analog pins |
C_IN |
- |
C_OUT |
number of analog pins |
Back to the top |
MIOS_AIN_NumberSet |
C_DECLARATION |
void MIOS_AIN_NumberSet(unsigned char pots) |
DESCRIPTION |
sets number of available AIN pins If number > 64, value will be forced to 64 |
C_IN |
number of analog pins in <pots> |
C_OUT |
- |
Back to the top |
MIOS_AIN_Pin7bitGet |
C_DECLARATION |
unsigned char MIOS_AIN_Pin7bitGet(unsigned char pin) |
DESCRIPTION |
returns 7-bit value of AIN input |
C_IN |
number of analog input pin in <pin> |
C_OUT |
7-bit value |
Back to the top |
MIOS_AIN_PinGet |
C_DECLARATION |
unsigned int MIOS_AIN_PinGet(unsigned char pin) |
DESCRIPTION |
returns value of AIN input |
C_IN |
pin number in <pin> |
C_OUT |
10bit value |
Back to the top |
MIOS_AIN_PinLSBGet |
C_DECLARATION |
unsigned char MIOS_AIN_PinLSBGet(unsigned char pin) |
DESCRIPTION |
returns LSB value of AIN input |
C_IN |
pin number in <pin> |
C_OUT |
LSB value |
Back to the top |
MIOS_AIN_PinMSBGet |
C_DECLARATION |
unsigned char MIOS_AIN_PinMSBGet(unsigned char pin) |
DESCRIPTION |
returns MSB value of AIN input |
C_IN |
pin number in <pin> |
C_OUT |
MSB value |
Back to the top |
MIOS_AIN_UnMuxed |
C_DECLARATION |
void MIOS_AIN_UnMuxed(void) |
DESCRIPTION |
disables the MUX mode (8 pots can be connected directly to the analog input pins of the PIC |
C_IN |
- |
C_OUT |
- |
Back to the top |
MIOS_MF_DeadbandGet |
C_DECLARATION |
unsigned char MIOS_MF_DeadbandGet(void) |
DESCRIPTION |
returns the deadband value for MF driver |
C_IN |
- |
C_OUT |
deadband value |
Back to the top |
MIOS_MF_DeadbandSet |
C_DECLARATION |
void MIOS_MF_DeadbandSet(unsigned char deadband) |
DESCRIPTION |
sets the deadband value for MF driver |
C_IN |
deadband value in <deadband> |
C_OUT |
- |
NOTE |
function can only be used when motordriver has been enabled. |
Back to the top |
MIOS_MF_Disable |
C_DECLARATION |
void MIOS_MF_Disable(void) |
DESCRIPTION |
disables the MF module |
C_IN |
- |
C_OUT |
- |
Back to the top |
MIOS_MF_Enable |
C_DECLARATION |
void MIOS_MF_Enable(void) |
DESCRIPTION |
enables the MF module - in this mode, multiplexers are disabled. Up to 8 motorfaders can be controlled over the MUX port. This function can only be used when the motordriver has been enabled. |
C_IN |
- |
C_OUT |
- |
C_EXAMPLE |
;; initialize the MF driver for Alps RSAON11M9 faders
MIOS_MF_Enable();
MIOS_MF_DeadbandSet(3);
MIOS_MF_PWM_DutyCycleUpSet(1);
MIOS_MF_PWM_DutyCycleDownSet(1);
MIOS_MF_PWM_PeriodSet(3);
|
Back to the top |
MIOS_MF_FaderMove |
C_DECLARATION |
void MIOS_MF_FaderMove(unsigned char fader, unsigned int pos) |
DESCRIPTION |
set target position and move fader |
C_IN |
fader number in <fader>, fader position in <pos> |
NOTE |
function can only be used when motordriver has been enabled. |
C_EXAMPLE |
// move fader #7 to highest position (0x3ff)
MIOS_MF_FaderMove(0x07, 0x3ff);
|
Back to the top |
MIOS_MF_PWM_DutyCycleDownGet |
C_DECLARATION |
unsigned char MIOS_MF_PWM_DutyCycleDownGet(void) |
DESCRIPTION |
Returns the Duty Cycle for downward moves - see http://www.ucapps.de/mbhp_mf.html for detailed informations about this value |
C_IN |
- |
C_OUT |
Duty Cycle |
Back to the top |
MIOS_MF_PWM_DutyCycleDownSet |
C_DECLARATION |
void MIOS_MF_PWM_DutyCycleDownSet(unsigned char cali_down) |
DESCRIPTION |
Sets the Duty Cycle for downward moves - see http://www.ucapps.de/mbhp_mf.html for detailed informations about this value |
C_IN |
Duty Cycle in <cali_down> |
C_OUT |
- |
Back to the top |
MIOS_MF_PWM_DutyCycleUpGet |
C_DECLARATION |
unsigned char MIOS_MF_PWM_DutyCycleUpGet(void) |
DESCRIPTION |
Returns the Duty Cycle for upward moves - see http://www.ucapps.de/mbhp_mf.html for detailed informations about this value |
C_IN |
- |
C_OUT |
Duty Cycle |
Back to the top |
MIOS_MF_PWM_DutyCycleUpSet |
C_DECLARATION |
void MIOS_MF_PWM_DutyCycleUpSet(unsigned char cali_up) |
DESCRIPTION |
Sets the Duty Cycle for upward moves - see http://www.ucapps.de/mbhp_mf.html for detailed informations about this value |
C_IN |
Duty Cycle in <cali_up> |
C_OUT |
- |
Back to the top |
MIOS_MF_PWM_PeriodGet |
C_DECLARATION |
unsigned char MIOS_MF_PWM_PeriodGet(void) |
DESCRIPTION |
Returns the PWM period - see http://www.ucapps.de/mbhp_mf.html for detailed informations about this value |
C_IN |
- |
C_OUT |
PWM period |
Back to the top |
MIOS_MF_PWM_PeriodSet |
C_DECLARATION |
void MIOS_MF_PWM_PeriodSet(unsigned char speed) |
DESCRIPTION |
Sets the PWM period - see http://www.ucapps.de/mbhp_mf.html for detailed informations about this value |
C_IN |
PWM period in <speed> |
C_OUT |
- |
Back to the top |
MIOS_MF_SuspendDisable |
C_DECLARATION |
void MIOS_MF_SuspendDisable(unsigned char fader) |
DESCRIPTION |
deactivate suspend mode of motor (function used by touchsensor detection) function can only be used when motordriver has been enabled. |
C_IN |
number of motor in <fader> (0-7) |
C_OUT |
- |
Back to the top |
MIOS_MF_SuspendEnable |
C_DECLARATION |
void MIOS_MF_SuspendEnable(unsigned char fader) |
DESCRIPTION |
suspends the motor (function used by touchsensor detection) function can only be used when motordriver has been enabled. |
C_IN |
number of motor in <fader> (0-7) |
C_OUT |
- |
Back to the top |
MIOS_MF_SuspendGet |
C_DECLARATION |
unsigned char MIOS_MF_SuspendGet(unsigned char fader) |
DESCRIPTION |
return suspend state of motor |
C_IN |
number of motor in <fader> (0-7) |
C_OUT |
1 if motor is suspended, else 0 |
Back to the top |
MIOS_MF_TouchDetectionReset |
C_DECLARATION |
void MIOS_MF_TouchDetectionReset(unsigned char fader) |
DESCRIPTION |
this function resets the software implemented touch detection so that the fader is repositioned regardless if it is currently manually moved or not |
C_IN |
number of motor in <fader> (0-7) |
C_OUT |
- |
Back to the top |
MIOS_DIN_PinAutoRepeatDisable |
C_DECLARATION |
void MIOS_DIN_PinAutoRepeatDisable(unsigned char pin) |
DESCRIPTION |
disables the auto-repeat feature for the appr. pin |
C_IN |
number of pin in <pin> |
C_OUT |
- |
Back to the top |
MIOS_DIN_PinAutoRepeatEnable |
C_DECLARATION |
void MIOS_DIN_PinAutoRepeatEnable(unsigned char pin) |
DESCRIPTION |
enables the auto-repeat feature for the appr. pin |
C_IN |
number of pin in <pin> |
C_OUT |
- |
Back to the top |
MIOS_DIN_PinAutoRepeatGet |
C_DECLARATION |
unsigned char MIOS_DIN_PinAutoRepeatGet(unsigned char pin) |
DESCRIPTION |
returns != 0 if auto-repeat has been enabled for the appr. pin |
C_IN |
number of pin in <pin> |
C_OUT |
!= 0 if auto-repeat has been enabled for this pin 0 if auto-repeat has been disabled for this pin |
Back to the top |
MIOS_DIN_PinGet |
C_DECLARATION |
unsigned char MIOS_DIN_PinGet(unsigned char pin) |
DESCRIPTION |
returns value from a DIN Pin |
C_IN |
Pin number in <pin> |
C_OUT |
1 if pin is +5V, 0 if pin is 0V |
Back to the top |
MIOS_DIN_SRGet |
C_DECLARATION |
unsigned char MIOS_DIN_SRGet(unsigned char sr) |
DESCRIPTION |
returns value of DIN shift register |
C_IN |
number of shift register in <sr> |
C_OUT |
value of shift register |
Back to the top |
MIOS_DOUT_PinGet |
C_DECLARATION |
unsigned char MIOS_DOUT_PinGet(unsigned char pin) |
DESCRIPTION |
returns value from a DOUT Pin |
C_IN |
Pin number in <pin> |
C_OUT |
1 if pin is +5V, 0 if pin is 0V |
Back to the top |
MIOS_DOUT_PinSet |
C_DECLARATION |
void MIOS_DOUT_PinSet(unsigned char pin, unsigned char value) |
DESCRIPTION |
set pin to 0 or 5V |
C_IN |
Pin number in <pin>, value in <value> |
Back to the top |
MIOS_DOUT_PinSet0 |
C_DECLARATION |
void MIOS_DOUT_PinSet0(unsigned char pin) |
DESCRIPTION |
set pin to 0V |
C_IN |
Pin number in WREG |
Back to the top |
MIOS_DOUT_PinSet1 |
C_DECLARATION |
void MIOS_DOUT_PinSet1(unsigned char pin) |
DESCRIPTION |
set pin to 5V |
C_IN |
Pin number in <pin> |
Back to the top |
MIOS_DOUT_SRGet |
C_DECLARATION |
unsigned char MIOS_DOUT_SRGet(unsigned char sr) |
DESCRIPTION |
returns value of DOUT shift register |
C_IN |
number of shift register in <sr> |
C_OUT |
value of shift register |
Back to the top |
MIOS_DOUT_SRSet |
C_DECLARATION |
void MIOS_DOUT_SRSet(unsigned char sr, unsigned char sr_value) |
DESCRIPTION |
sets value of DOUT shift register |
C_IN |
number of shift register in <sr> value in <sr_value> |
C_OUT |
- |
Back to the top |
MIOS_ENC_Abs7bitAdd |
C_DECLARATION |
void MIOS_ENC_Abs7bitAdd(unsigned char enc, unsigned char value) |
DESCRIPTION |
adds the incrementer to the absolute 7-bit value of encoder This function saturates the value. That means: if the resulting value is greater than 127, it will be saturated to 127. The same will be done when the value is less than 0 |
C_IN |
encoder number in <enc> incrementer value in <value> |
C_OUT |
returns new absolute value in MIOS_PARAMETER1 MIOS_PARAMETER2[0] is 1, if the value has been changed, 0 if it is equal to the old value |
NOTE |
This function uses a spare register which is only available when the encoder speed is set to MIOS_ENC_SPEED_NORMAL. In all other speed modes (MIOS_ENC_SPEED_SLOW and MIOS_ENC_SPEED_FAST) this function should NOT be used, instead a dedicated handler for absolute values should be written in this case (see enc_example* applications) |
C_EXAMPLE |
// subtract -5 from the 7-bit value of encoder #0
MIOS_ENC_Abs7bitAdd(0, -5);
|
Back to the top |
MIOS_ENC_Abs7bitGet |
C_DECLARATION |
unsigned char MIOS_ENC_Abs7bitGet(unsigned char enc) |
DESCRIPTION |
returns absolute 7-bit value of encoder |
C_IN |
encoder number in <enc> |
C_OUT |
absolute value |
NOTE |
This function uses a spare register which is only available when the encoder speed is set to MIOS_ENC_SPEED_NORMAL. In all other speed modes (MIOS_ENC_SPEED_SLOW and MIOS_ENC_SPEED_FAST) this function should NOT be used, instead a dedicated handler for absolute values should be written in this case (see enc_example* applications) |
C_EXAMPLE |
// get the current 7-bit value of encoder #0
value = MIOS_ENC_Abs7bitGet(0);
|
Back to the top |
MIOS_ENC_Abs7bitSet |
C_DECLARATION |
void MIOS_ENC_Abs7bitSet(unsigned char enc, unsigned char value) |
DESCRIPTION |
sets the absolute 7-bit value of encoder |
C_IN |
encoder number in <enc>, absolute value in <value> |
NOTE |
This function uses a spare register which is only available when the encoder speed is set to MIOS_ENC_SPEED_NORMAL. In all other speed modes (MIOS_ENC_SPEED_SLOW and MIOS_ENC_SPEED_FAST) this function should NOT be used, instead a dedicated handler for absolute values should be written in this case (see enc_example* applications) |
C_EXAMPLE |
// set the 7-bit value of encoder #0 to 0x40
MIOS_ENC_Abs7bitSet(0, 0x40);
|
Back to the top |
MIOS_ENC_NumberGet |
C_DECLARATION |
unsigned char MIOS_ENC_NumberGet(void) |
DESCRIPTION |
returns the number of encoders which have been defined in the encoder table |
C_IN |
- |
C_OUT |
number of encoders |
Back to the top |
MIOS_ENC_SpeedGet |
C_DECLARATION |
unsigned char MIOS_ENC_SpeedGet(unsigned char enc) |
DESCRIPTION |
returns the speed setting for an encoder following settings are available: MIOS_ENC_SPEED_SLOW 0x00 MIOS_ENC_SPEED_NORMAL 0x01 MIOS_ENC_SPEED_FAST 0x02
|
C_IN |
encoder number in <enc> |
C_OUT |
returns speed mode speed parameter in MIOS_PARAMETER2 |
C_EXAMPLE |
// return the speed setting of encoder #0
speed = MIOS_ENC_SpeedGet(0);
|
Back to the top |
MIOS_ENC_SpeedSet |
C_DECLARATION |
void MIOS_ENC_SpeedSet(unsigned char enc, unsigned char mode, unsigned char parameter) |
DESCRIPTION |
sets the speed for an encoder following settings are available: MIOS_ENC_SPEED_SLOW 0x00 (requires additional parameter) MIOS_ENC_SPEED_NORMAL 0x01 (no additional parameter) MIOS_ENC_SPEED_FAST 0x02 (requires additional parameter)
|
C_IN |
encoder number in <enc> speed mode in <mode> speed parameter in <parameter> |
NOTE |
When using MIOS_ENC_SPEED_SLOW or MIOS_ENC_SPEED_FAST, the MIOS_ENC_Abs* functions are not available since these speed modes allocate a spare register which is normaly used to store the absolute value. So, in this case a dedicated handler for absolute values should be written (see enc_example* applications) |
C_EXAMPLE |
MIOS_ENC_SPEED_NORMAL
~~~~~~~~~~~~~~~~~~~~~
// this speed mode requires no additional parameter (should be zero)
// set speed of encoder #0 to "normal"
MIOS_ENC_SpeedSet(0, MIOS_ENC_SPEED_NORMAL, 0);
MIOS_ENC_SPEED_SLOW
~~~~~~~~~~~~~~~~~~~
// this speed mode allows to define a predivider value
// from 0 to 7
// set speed for encoder #0 to "slow", use a predivider
// of 3 so that the encoder will increment every 4th
// step (predivider value (- 1))
MIOS_ENC_SpeedSet(0, MIOS_ENC_SPEED_SLOW, 3);
MIOS_ENC_SPEED_FAST
~~~~~~~~~~~~~~~~~~~
// in this speed mode the increment value depends on the
// rotational speed based on the following formula:
// speed_ctr: decremented with every update cycle
// (-> MIOS_SRIO_UpdateFrqSet)
// (normaly 1 ms) to measure the time between
// two encoder steps
// Init value: 0x7f
// reaches 0x00 after 127 update cycles
// (normaly after 127 ms)
// <parameter>: specified with the MIOS_ENC_SpeedSet
//
// function, allowed values:
// 0 (fast) -> divider = 2^(7-0) = 128
// 1 (faster) -> divider = 2^(7-1) = 64
// ...
// 7 (fastest) -> divider = 2^(7-7) = 1
// ->
// incrementer = speed_ctr / (2^(7-parameter))
// set speed for encoder #0 to "fast", speed exponent value is 2
MIOS_ENC_SpeedSet(0, MIOS_ENC_SPEED_FAST, 2);
|
Back to the top |
MIOS_SRIO_DebounceGet |
C_DECLARATION |
unsigned char MIOS_SRIO_DebounceGet(void) |
DESCRIPTION |
returns the debounce counter reload value of the DIN SR registers |
C_IN |
- |
C_OUT |
debounce counter reload value |
Back to the top |
MIOS_SRIO_DebounceSet |
C_DECLARATION |
void MIOS_SRIO_DebounceSet(unsigned char debounce_value) |
DESCRIPTION |
sets the debounce counter reload value for the DIN SR registers which are not assigned to rotary encoders to debounce low-quality buttons.
Debouncing is realized in the following way: on every button movement the debounce preload value will be loaded into the debounce counter register. The counter will be decremented on every SRIO update cycle. So long as this counter isn't zero, button changes will still be recorded, but they won't trigger the USER_DIN_NotifyToggle function.
No (intended) button movement will get lost, but the latency will be increased. Example: if the update frequency is set to 1 mS, and the debounce value to 32, the first button movement will be regognized with a worst-case latency of 1 mS. Every additional button movement which happens within 32 mS will be regognized within a worst-case latency of 32 mS. After the debounce time has passed, the worst-case latency is 1 mS again.
Note that in MIOS versions below v1.9c, the debounce counter also affected the rotary encoders and DOUT registers (they where not serviced). With MIOS V1.9c and higher, this problem doesn't exist anymore and the debouncing feature can be used in nearly all applications. Only exception: if the application should record pin changes from digital sensors which are switching very fast, then debouncing should be ommited. |
C_IN |
debounce counter reload value in <debounce_value> |
C_OUT |
- |
Back to the top |
MIOS_SRIO_NumberGet |
C_DECLARATION |
unsigned char MIOS_SRIO_NumberGet(void) |
DESCRIPTION |
returns number of available SR registers |
C_IN |
- |
C_OUT |
number of SRs |
Back to the top |
MIOS_SRIO_NumberSet |
C_DECLARATION |
void MIOS_SRIO_NumberSet(unsigned char number_sr) |
DESCRIPTION |
sets number of available SR registers If number > 16, value will be forced to 16 |
C_IN |
number of SRs in <number_sr> |
C_OUT |
- |
Back to the top |
MIOS_SRIO_TS_SensitivityGet |
C_DECLARATION |
unsigned char MIOS_SRIO_TS_SensitivityGet(void) |
DESCRIPTION |
returns the touchsensor sensitivity |
C_IN |
- |
C_OUT |
sensitivity value |
Back to the top |
MIOS_SRIO_TS_SensitivitySet |
C_DECLARATION |
void MIOS_SRIO_TS_SensitivitySet(unsigned char sensitivity) |
DESCRIPTION |
sets the touch sensor sensitivity. sensitivity == 0x00 disables the TS so that Pin RD.4 (J14 of the core module) won't be driven by MIOS anymore and therefore is free for other purposes |
C_IN |
sensitivity value in <sensitivity> |
C_OUT |
- |
Back to the top |
MIOS_SRIO_UpdateFrqGet |
C_DECLARATION |
unsigned char MIOS_SRIO_UpdateFrqGet(void) |
DESCRIPTION |
returns the update frequency of SR registers |
C_IN |
- |
C_OUT |
update frequency (unit: milliseconds) |
Back to the top |
MIOS_SRIO_UpdateFrqSet |
C_DECLARATION |
void MIOS_SRIO_UpdateFrqSet(unsigned char update_frq) |
DESCRIPTION |
sets the update frequency of SR registers |
C_IN |
update frequency (unit: milliseconds) in <update_frq> |
C_OUT |
- |
Back to the top |
MIOS_LCD_Clear |
C_DECLARATION |
void MIOS_LCD_Clear(void) |
DESCRIPTION |
clears the LCD screen |
C_IN |
- |
C_OUT |
- |
C_EXAMPLE |
// clear LCD and print a character
MIOS_LCD_Clear();
MIOS_LCD_PrintChar('A');
|
Back to the top |
MIOS_LCD_Cmd |
C_DECLARATION |
void MIOS_LCD_Cmd(unsigned char cmd) |
DESCRIPTION |
sends a command to the LCD display |
C_IN |
command which should be sent in <cmd> |
C_OUT |
- |
Back to the top |
MIOS_LCD_CursorGet |
C_DECLARATION |
unsigned char MIOS_LCD_CursorGet(void) |
DESCRIPTION |
returns the text cursor position 0x00-0x3f: first line 0x40-0x7f: second line 0x80-0xbf: third line or second LCD (if available) 0xc0-0xff: fourth line or second LCD (if available) |
C_IN |
- |
C_OUT |
text cursor position |
Back to the top |
MIOS_LCD_CursorSet |
C_DECLARATION |
void MIOS_LCD_CursorSet(unsigned char pos) |
DESCRIPTION |
sets the text cursor on LCD screen 0x00-0x3f: first line 0x40-0x7f: second line 0x80-0xbf: third line or second LCD (see MIOS_LCD_YAddressSet) 0xc0-0xff: fourth line or second LCD (see MIOS_LCD_YAddressSet) |
C_IN |
- |
C_OUT |
- |
C_EXAMPLE |
// print char at first line, first column
MIOS_LCD_CursorSet(0x00 + 0);
MIOS_LCD_PrintChar('A');
// print char at second line, last column (2x16 LCD)
MIOS_LCD_CursorSet(0x40 + 15);
MIOS_LCD_PrintChar('B');
// print chars on second LCD
// (or 3rd and 4th line, see see MIOS_LCD_YAddressSet)
MIOS_LCD_CursorSet(0x80 + 0);
MIOS_LCD_PrintChar('C');
MIOS_LCD_CursorSet(0xc0 + 15);
MIOS_LCD_PrintChar('D');
|
Back to the top |
MIOS_LCD_Data |
C_DECLARATION |
void MIOS_LCD_Data(unsigned char data) |
DESCRIPTION |
sends a data value to the LCD display |
C_IN |
data which should be sent in <data> |
C_OUT |
- |
Back to the top |
MIOS_LCD_Init |
C_DECLARATION |
void MIOS_LCD_Init(void) |
DESCRIPTION |
initializes the LCD display this function is called automatically after startup |
C_IN |
- |
C_OUT |
- |
Back to the top |
MIOS_LCD_MessageStart |
C_DECLARATION |
void MIOS_LCD_MessageStart(unsigned char delay) |
DESCRIPTION |
a replacement for MIOS_LCD_PrintMessage which allows to start a message without calling "MIOS_LCD_PrintString" |
C_IN |
message delay in <delay> |
C_OUT |
- |
C_EXAMPLE |
// print message on LCD for 2 seconds
MIOS_LCD_CursorSet(0x00 + 0);
MIOS_LCD_PrintCString("Pot value: ");
MIOS_LCD_PrintHex2(MIOS_AIN_Pin7bitGet(0));
MIOS_LCD_MessageStart(255);
|
Back to the top |
MIOS_LCD_MessageStop |
C_DECLARATION |
void MIOS_LCD_MessageStop(void) |
DESCRIPTION |
this function allows to stop the message immediately so that MIOS_LCD_Tick will be called again |
C_IN |
- |
C_OUT |
- |
C_EXAMPLE |
// stop message immediately and invoke DISPLAY_Tick again
MIOS_LCD_MessageStop();
|
Back to the top |
MIOS_LCD_PrintBCD1 |
C_DECLARATION |
void MIOS_LCD_PrintBCD1(unsigned char v) |
DESCRIPTION |
prints a 8-bit as BCD (decimal value) -- one digit only |
C_EXAMPLE |
unsigned char value;
// print leftmost digit of 'value' on screen
MIOS_LCD_PrintBCD1(value);
|
Back to the top |
MIOS_LCD_PrintBCD2 |
C_DECLARATION |
void MIOS_LCD_PrintBCD2(unsigned char v) |
DESCRIPTION |
prints a 8-bit as BCD (decimal value) -- two digits only |
C_IN |
Value in <v> |
C_OUT |
two digits on LCD |
C_EXAMPLE |
unsigned char value;
// print two leftmost digits of 'value' on screen
MIOS_LCD_PrintBCD2(value);
|
Back to the top |
MIOS_LCD_PrintBCD3 |
C_DECLARATION |
void MIOS_LCD_PrintBCD3(unsigned char v) |
DESCRIPTION |
prints a 8-bit as BCD (decimal value) -- all three digits |
C_IN |
Value in <v> |
C_OUT |
three digits on LCD |
C_EXAMPLE |
unsigned char value;
// print all three digits of 'value' on screen
MIOS_LCD_PrintBCD3(value);
|
Back to the top |
MIOS_LCD_PrintBCD4 |
C_DECLARATION |
void MIOS_LCD_PrintBCD4(unsigned int v) |
DESCRIPTION |
prints a 16-bit as BCD (decimal value) -- four digits |
C_IN |
16bit value in <v> |
C_EXAMPLE |
unsigned int value;
// print four leftmost digits of 'value' on screen
MIOS_LCD_PrintBCD4(value);
|
Back to the top |
MIOS_LCD_PrintBCD5 |
C_DECLARATION |
void MIOS_LCD_PrintBCD5(unsigned int v) |
DESCRIPTION |
prints a 16-bit as BCD (decimal value) -- five digits |
C_IN |
16bit value in <v> |
C_EXAMPLE |
unsigned int value;
// print all five digits of 'value' on screen
MIOS_LCD_PrintBCD5(value);
|
Back to the top |
MIOS_LCD_PrintCString |
C_DECLARATION |
void MIOS_LCD_PrintCString(code char *str) |
DESCRIPTION |
prints a 0-terminated string --- only provided by the MIOS C Wrapper! |
C_IN |
Pointer to 0-terminated String in <str> |
C_EXAMPLE |
// print string on LCD - first line, first column
MIOS_LCD_CursorSet(0x00 + 0);
MIOS_LCD_PrintCString("Hello World!");
|
Back to the top |
MIOS_LCD_PrintChar |
C_DECLARATION |
void MIOS_LCD_PrintChar(unsigned char c) |
DESCRIPTION |
prints a single ASCII character |
C_IN |
character which should be print in <c> |
C_OUT |
the character on LCD screen |
C_EXAMPLE |
;; print four characters on screen
MIOS_LCD_PrintChar('M');
MIOS_LCD_PrintChar('I');
MIOS_LCD_PrintChar('O');
MIOS_LCD_PrintChar('S');
|
Back to the top |
MIOS_LCD_PrintHex1 |
C_DECLARATION |
void MIOS_LCD_PrintHex1(unsigned char h) |
DESCRIPTION |
prints a 4-bit hex value |
C_IN |
Value in <h> |
C_OUT |
one digit on LCD |
C_EXAMPLE |
unsigned char value;
// print leftmost nibble of 'value' on screen
MIOS_LCD_PrintHex1(value);
|
Back to the top |
MIOS_LCD_PrintHex2 |
C_DECLARATION |
void MIOS_LCD_PrintHex2(unsigned char h) |
DESCRIPTION |
prints a 8-bit hex value |
C_IN |
Value in <h> |
C_EXAMPLE |
unsigned char value;
// print content of 'value' on screen
MIOS_LCD_PrintHex2(value);
|
Back to the top |
MIOS_LCD_PrintMessage |
C_DECLARATION |
void MIOS_LCD_PrintMessage(code char *str) |
DESCRIPTION |
prints a message for about 2 seconds. Normal program flow will not be stopped during this time, just only the "DISPLAY_Tick" routine will not be called. After the message, "DISPLAY_Init" will be invoked before the next "DISPLAY_Tick" |
C_IN |
Pointer to String in <str> First word of string must contain length and LCD position |
C_OUT |
some characters on LCD for 2 seconds |
C_EXAMPLE |
// consider the use of MIOS_LCD_PrintMessageStart
// see also the appr. example
|
Back to the top |
MIOS_LCD_PrintPreconfString |
C_DECLARATION |
void MIOS_LCD_PrintPreconfString(unsigned char len, code char *str) |
DESCRIPTION |
prints a preconfigured string |
C_IN |
Pointer to String in <str> Stringlength in <len> |
C_EXAMPLE |
// defined somewhere *outside* the function!
const unsigned char text_welcome_0[] = { "Hello World!" };
// within the function: print string
MIOS_LCD_CursorSet(0x00 + 0);
MIOS_LCD_PrintPreconfString(12, text_welcome_0);
// please see also the MIOS_LCD_PrintCString function!
|
Back to the top |
MIOS_LCD_PrintString |
C_DECLARATION |
void MIOS_LCD_PrintString(code char *str) |
DESCRIPTION |
prints a string |
C_IN |
Pointer to String in <str> First word of string must contain length and LCD position |
C_EXAMPLE |
// defined somewhere *outside* the function!
const unsigned char text_welcome_0[] = { 12, 0x00, "Hello World!" };
// within the function: print string
MIOS_LCD_PrintString(text_welcome_0);
// please see also the MIOS_LCD_PrintCString function!
|
Back to the top |
MIOS_LCD_TypeAutoSet |
C_DECLARATION |
unsigned char MIOS_LCD_TypeAutoSet(void) |
DESCRIPTION |
derives the LCD type from the PIC ID header |
C_IN |
- |
C_OUT |
type in WREG, additional LCD parameters in MIOS_PARAMETER1 and MIOS_PARAMETER2 |
C_EXAMPLE |
// set LCD type to the specified type in the PIC ID header
MIOS_LCD_TypeAutoSet();
|
Back to the top |
MIOS_LCD_TypeGet |
C_DECLARATION |
unsigned char MIOS_LCD_TypeGet(void) |
DESCRIPTION |
returns the LCD type Following LCDs are provided: 0x00: MIOS_LCD_TYPE_CLCD (character dotmatrix LCD) 0x01: MIOS_LCD_TYPE_GLCD0 (graphical LCD, KS0108 or HD61202 compatible) 0x06: MIOS_LCD_TYPE_MLCD (MIDI display, see SysEx implementation) 0x07: MIOS_LCD_TYPE_CUSTOM_LCD (custom LCD driver)
|
C_IN |
- |
C_OUT |
LCD type |
C_EXAMPLE |
// branch depending on LCD type
if( MIOS_LCD_TypeGet() == MIOS_LCD_TYPE_CLCD ) {
// do something special if CLCD connected
}
// !!! Better for branching depending on CLCD/GLCD type display !!!
// !!! (works also with custom LCD driver !!!
if( !MIOS_BOX_CFG0.USE_GLCD ) {
// do something special if CLCD connected
}
|
Back to the top |
MIOS_LCD_TypeSet |
C_DECLARATION |
void MIOS_LCD_TypeSet(unsigned char type, unsigned char par1, unsigned char par2) |
DESCRIPTION |
sets the LCD type. Following LCDs are provided: 0x00: MIOS_LCD_TYPE_CLCD (character dotmatrix LCD) 0x01: MIOS_LCD_TYPE_GLCD0 (graphical LCD, KS0108 or HD61202 compatible) 0x06: MIOS_LCD_TYPE_MLCD (MIDI display, see SysEx implementation) 0x07: MIOS_LCD_TYPE_CUSTOM_LCD (custom LCD driver) Note that the MIOS_LCD_TypeAutoSet function allows you to derive the LCD type from the PIC ID header! Use this function only if you want to force a special LCD type without changing the ID header of your PIC or if you want to set additional LCD options which are different from the default values |
C_IN |
LCD type in <type> LCD Option #1 <par1> LCD Option #2 <par2> |
C_EXAMPLE |
The available LCD options differ with the used LCD type, here a list:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Type 0, CLCD:
with <par1> and <par2> the enable (E) pins of
the character displays are specified. By default the E input of
the first CLCD should be connected to pin D.7, the E input of
the second CLCD (if available) to C.4
Following lines of code are necessary to achieve this:
// use a CLCD, E input of first CLCD at D.7, E of second CLCD @C.4
MIOS_LCD_TypeSet(MIOS_LCD_TYPE_CLCD, 0x37, 0x24);
Note: the first digit of the parameter value sets the port number
(A=0, B=1, C=2, D=3, E=4)
the second digit sets the pin number (0-7)
bit #7 sets the interface (0=8bit, 0=7bit)
Example for CLCD with 4bit interface:
;; use a CLCD, E input of first CLCD at D.7, E of second CLCD @C.4
;; using the 4-bit interface:
;; -> connect MBHP_CORE:J15:D7-D4 of the core module to D7-D4 of the LCD
;; -> left MBHP_CORE:J15:D3-D0 of the core module open!
;; -> tie D3-D0 of the LCD to ground
MIOS_LCD_TypeSet(MIOS_LCD_TYPE_CLCD, 0x80 | 0x37, 0x80 | 0x24);
Tip: by changing these parameters dynamically you are also able to
drive more than 2 LCDs with one core module. Only the number
of free pins limit the number of CLCDs which can be driven!
Don't forget to switch the appr. pins to output before using
them, and call MIOS_LCD_Init for every display pair in your
USER_Init
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Type 1, KS0108 or HD61202 based
with <par1> it has to be specified if the chip select
lines are inverted
// use a KS0108 or HD61202 compatible graphical LCD with
// non-inverted chip selects
MIOS_LCD_TypeSet(MIOS_LCD_TYPE_GLCD0, 0x00, 0x00); // (par2 unusued)
OR:
// use a KS0108 or HD61202 compatible graphical LCD with inverted
// chip selects
MIOS_LCD_TypeSet(MIOS_LCD_TYPE_GLCD0, 0x01, 0x00); // (par2 unusued)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Type 2, T6963C based
not supported anymore, use the custom driver instead which are
available in the MIOS download section
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Type 6, MIDI display
see the MIOS SysEx implementation which is available in the MIOS
download section
MIOS_PARAMETER1 defines the device ID of the target core:
;; send MIDI messages to core with device ID 0x42
MIOS_LCD_TypeSet(MIOS_LCD_TYPE_MLCD, 0x42, 0x00); // (par2 unusued)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Type 7, custom LCD driver
options are forwarded to the custom LCD driver
following hooks have been prepared for an easy integration into
MIOS:
USER_LCD_Init
USER_LCD_Clear
USER_LCD_CursorSet
USER_LCD_PrintChar
|
Back to the top |
MIOS_LCD_YAddressGet |
C_DECLARATION |
unsigned char MIOS_LCD_YAddressGet(void) |
DESCRIPTION |
returns the Y offsets |
C_IN |
- |
C_OUT |
Line Y0 address in MIOS_PARAMETER1 (global variable defined in cmios.h), Line Y1 address in MIOS_PARAMETER2 (global variable defined in cmios.h), Line Y2 address in MIOS_PARAMETER3 (global variable defined in cmios.h), Line Y3 address directly returned |
Back to the top |
MIOS_LCD_YAddressSet |
C_DECLARATION |
void MIOS_LCD_YAddressSet(unsigned char line0, unsigned char line1, unsigned char line2, unsigned char line3); |
DESCRIPTION |
maps the Y position of the cursor to the appr. cursor address of character and graphical displays. By default the positions are configured for 2x16, 2x20, 4x20 and 2x40 displays: Line0 -> MIOS cursor offset: 0x00 -> cursor address 0x00 Line1 -> MIOS cursor offset: 0x40 -> cursor address 0x40 Line2 -> MIOS cursor offset: 0x80 -> cursor address 0x14 (4x20 only) Line3 -> MIOS cursor offset: 0xc0 -> cursor address 0x54 (4x20 only) For 4x16 displays, the configuration has to be changed: Line0 -> MIOS cursor offset: 0x00 -> cursor address 0x00 Line1 -> MIOS cursor offset: 0x40 -> cursor address 0x40 Line2 -> MIOS cursor offset: 0x80 -> cursor address 0x10 (4x16 only) Line3 -> MIOS cursor offset: 0xc0 -> cursor address 0x50 (4x16 only) For 2 character displays connected to one core use: Line0 -> MIOS cursor offset: 0x00 -> cursor address 0x00 Line1 -> MIOS cursor offset: 0x40 -> cursor address 0x40 Line2 -> MIOS cursor offset: 0x80 -> cursor address 0x80 Line3 -> MIOS cursor offset: 0xc0 -> cursor address 0xc0 (first LCD is addressed by 0x00-0x7f, second LCD is addressed by 0x80-0xff) This function allows also to center the screen if you want to run Applications which have been developed for a 2x16 display on a larger display. Example for a 2x20 Display: Line0 -> MIOS cursor offset: 0x00 -> cursor address 0x04 Line1 -> MIOS cursor offset: 0x40 -> cursor address 0x44 Line2 -> don't care Line3 -> don't care
|
C_IN |
Line Y0 address in <line0> Line Y1 address in <line1> Line Y2 address in <line2> Line Y3 address in <line3> |
C_EXAMPLE |
// configure the offsets for a 4x16 LCD:
MIOS_LCD_YAddressSet(0x00, 0x40, 0x10, 0x50);
// configure MIOS for 2 character LCDs:
// (see also http://www.ucapps.de/mbhp_lcd.html )
MIOS_LCD_YAddressSet(0x00, 0x40, 0x80, 0xc0);
|
Back to the top |
MIOS_CLCD_SpecialCharInit |
C_DECLARATION |
void MIOS_CLCD_SpecialCharInit(unsigned char num, code char *c_table) |
DESCRIPTION |
initializes one of 8 special characters provided by a HD44780 compatible character LCD |
C_IN |
number of special character (0-7) in <num> pointer to special char pattern in <c_table> (must consist of 8 entries for every character-line) |
C_OUT |
- |
C_EXAMPLE |
see http://www.ucapps.de/mios_c_lcd_schars.html
|
Back to the top |
MIOS_CLCD_SpecialCharsInit |
C_DECLARATION |
void MIOS_CLCD_SpecialCharsInit(const char *c_table) |
DESCRIPTION |
initializes all 8 special characters provided by a HD44780 compatible character LCD See also: MIOS_CLCD_SpecialCharInit |
C_IN |
pointer to special char patterns in <c_table> (must consist of 8*8 entries for every character and line) |
C_OUT |
- |
C_EXAMPLE |
see http://www.ucapps.de/mios_c_lcd_schars.html
|
Back to the top |
MIOS_GLCD_FontInit |
C_DECLARATION |
void MIOS_GLCD_FontInit(code char *font) |
DESCRIPTION |
initializes a font, (animated icon) or bitmap Note that this function works with graphical LCDs only! |
C_IN |
pointer to font header in <font> |
C_EXAMPLE |
// set default font:
MIOS_GLCD_FontInit(MIOS_GLCD_FONT)
// set cursor to 0
MIOS_LCD_CursorSet(0x00);
// print character 'A'
MIOS_LCD_PrintChar('A');
|
Back to the top |
MIOS_GLCD_GCursorGet |
C_DECLARATION |
unsigned char MIOS_GLCD_GCursorGet(void) |
DESCRIPTION |
returns the position of the graphical cursor Note that this function works with graphical LCDs only! |
C_IN |
- |
C_OUT |
X position returned directly Y position in MIOS_PARAMETER1 (global variable defined in cmios.h) |
Back to the top |
MIOS_GLCD_GCursorSet |
C_DECLARATION |
void MIOS_GLCD_GCursorSet(unsigned char x, unsigned char y) |
DESCRIPTION |
sets the graphical cursor on a LCD screen Note that this function works with graphical LCDs only! |
C_IN |
X position in <x> (0-239) Y position in <y> (0-7) |
C_EXAMPLE |
// set graphical cursor to 160/7:
MIOS_GLCD_GCursorSet(160, 7);
|
Back to the top |
MIOS_EEPROM_Read |
C_DECLARATION |
unsigned char MIOS_EEPROM_Read(unsigned char addr) |
DESCRIPTION |
reads a byte from EEPROM. |
C_IN |
address in <addr> (0x00-0xff) and EEADRH (0-3, PIC18F4620 only) |
C_OUT |
returns EEPROM content |
C_EXAMPLE |
// load a byte from address 0x80
value = MIOS_EEPROM_Read(0x80);
|
Back to the top |
MIOS_EEPROM_ReadPage |
C_DECLARATION |
unsigned char MIOS_EEPROM_ReadPage(unsigned char addr, unsigned char *buffer) |
DESCRIPTION |
reads a 64 bytes page from EEPROM The internal EEPROM of PIC18F452 doesn't provide a page read by itself, therefore this function calls MIOS_EEPROM_Read 64 times. |
C_IN |
pointer to read buffer (64 bytes) in <buffer> address in <addr> (0x00-0xc0) and EEADRH (0-3, PIC18F4620 only) |
C_OUT |
EEPROM content in read <buffer> |
C_EXAMPLE |
unsigned char buffer[64];
// read a page of 64 bytes from EEPROM at address 0x40
MIOS_EEPROM_ReadPage(0x40, buffer);
|
Back to the top |
MIOS_EEPROM_Write |
C_DECLARATION |
unsigned char MIOS_EEPROM_Write(unsigned char addr, unsigned char value) |
DESCRIPTION |
writes a byte into EEPROM. Write access will be skipped if content is equal to the byte which should be written Returned Error Status: 0x00: no error 0x01: byte mismatch (write failed) |
C_IN |
byte in <value>, address in <addr> (0x00-0xff), high byte in EEADRH (0-3, PIC18F4620 only) |
C_OUT |
error status |
C_EXAMPLE |
unsigned char error = 0;
// write 0x47 0x11 into EEPROM at address 0x80/0x81
error |= MIOS_EEPROM_Write(0x80, 0x47);
error |= MIOS_EEPROM_Write(0x81, 0x11);
if( error ) {
// here you could do some error handling
}
// note: it's very unlikely that an error happens when writing
// to internal EEPROM, therefore you can use following shortcut:
// write 0x47 0x11 into EEPROM at address 0x80/0x81
MIOS_EEPROM_Write(0x80, 0x47);
MIOS_EEPROM_Write(0x81, 0x11);
|
Back to the top |
MIOS_EEPROM_WritePage |
C_DECLARATION |
unsigned char MIOS_EEPROM_WritePage(unsigned char addr, unsigned char *buffer) |
DESCRIPTION |
writes a 64 bytes page into EEPROM. The internal EEPROM of PIC18F452 doesn't provide a page write by itself, therefore this function calls MIOS_EEPROM_Write 64 times. Returned Error Status: 0x00: no error 0x01: byte mismatch (one or more writes failed) |
C_IN |
pointer to write buffer (64 bytes) in <buffer> address in <addr> (0x00-0xc0) and EEADRH (0-3, PIC18F4620 only) |
C_OUT |
error status |
C_EXAMPLE |
unsigned char buffer[64];
unsigned char i;
// fill buffer with some bytes
for(i=0; i<64; ++i)
buffer[i] = i;
// write a page of 64 bytes to EEPROM memory at address 0x80
MIOS_EEPROM_WritePage(0x80, buffer);
|
Back to the top |
MIOS_FLASH_Read |
C_DECLARATION |
unsigned char MIOS_FLASH_Read(code char *addr, char *buffer) |
DESCRIPTION |
copies 64 bytes from FLASH memory to buffer |
C_IN |
pointer to read buffer (64 bytes) in <buffer> flash address in <addr> (0x0000-0x7fc0, must be aligned to 64 byte page) |
C_OUT |
memory dump in <buffer> |
C_EXAMPLE |
unsigned char buffer[64];
// read a page of 64 bytes from flash memory at address 0x7000
MIOS_FLASH_Read(0x7000, buffer);
|
Back to the top |
MIOS_FLASH_Write |
C_DECLARATION |
unsigned char MIOS_FLASH_Write(code char *addr, char *buffer) |
DESCRIPTION |
writes 64 bytes into FLASH memory Write access will be skipped if content is equal to the bytes in the buffer. Writes to MIOS prgram space will be prevented: PIC18F452: 0x0000-0x2fff not writable PIC18F4620: 0x0000-0x2fff not writable Returned Error Status: 0x00: no error 0x01: byte mismatch (write failed) 0x02: access error (memory protected) |
C_IN |
pointer to write buffer (64 bytes) in <buffer> flash address in <addr> (must be aligned to 64 byte page) |
C_OUT |
returns error status |
C_EXAMPLE |
unsigned char buffer[64];
unsigned char i;
// fill buffer with some bytes
for(i=0; i<64; ++i)
buffer[i] = i;
// write a page of 64 bytes to flash memory at address 0x7000
if( MIOS_FLASH_Write(0x7000, buffer) ) {
// error handler
}
|
Back to the top |
MIOS_BANKSTICK_CtrlGet |
C_DECLARATION |
unsigned char MIOS_BANKSTICK_CtrlGet(void) |
DESCRIPTION |
returns the BankStick control status |
C_IN |
- |
C_OUT |
bit [2..0]: A2-A0 bit [7]: Verify disabled |
Back to the top |
MIOS_BANKSTICK_CtrlSet |
C_DECLARATION |
void MIOS_BANKSTICK_CtrlSet(unsigned char ctrl) |
DESCRIPTION |
sets the BankStick control register bit 2-0: selects the BankStick (1 of 8, address defined with pin A0-A2 of the EEPROM) bit 7: if set, the verify during BankStick write will be disabled |
C_IN |
control register content in <ctrl> |
C_EXAMPLE |
unsigned char error = 0;
// write 0x47 0x11 to address 0x3000-0x3001 of the BankStick number 7
MIOS_BANKSTICK_CtrlSet(0x07); // select 8th BankStick
error |= MIOS_BANKSTICK_Write(0x3000, 0x47);
error |= MIOS_BANKSTICK_Write(0x3001, 0x11);
|
Back to the top |
MIOS_BANKSTICK_Read |
C_DECLARATION |
unsigned char MIOS_BANKSTICK_Read(unsigned int addr) |
DESCRIPTION |
reads a byte from BankStick. |
C_IN |
address in <addr> (0x0000-0xffff) |
C_OUT |
BankStick content MIOS_BOX_STAT.BS_AVAILABLE cleared if read failed |
C_EXAMPLE |
// load a byte from address 0x7fff (the last in a 32k BankStick)
value = MIOS_BANKSTICK_Read(0x7fff);
if( !MIOS_BOX_STAT.BS_AVAILABLE ) {
// here you could do some error handling
}
|
Back to the top |
MIOS_BANKSTICK_ReadPage |
C_DECLARATION |
unsigned char MIOS_BANKSTICK_ReadPage(unsigned int addr, unsigned char *buffer) |
DESCRIPTION |
reads a 64 bytes page from BankStick. |
C_IN |
pointer to read buffer (64 bytes) in <buffer><BR> address in <addr> (0x0000-0xffc0) |
C_OUT |
BankStick content in read buffer MIOS_BOX_STAT.BS_AVAILABLE is also zero if write failed |
C_EXAMPLE |
unsigned char buffer[64];
// read a page of 64 bytes from BankStick memory at address 0x1240
MIOS_BANKSTICK_ReadPage(0x1240, buffer);
if( !MIOS_BOX_STAT.BS_AVAILABLE ) {
// here you could do some error handling
}
|
Back to the top |
MIOS_BANKSTICK_Write |
C_DECLARATION |
unsigned char MIOS_BANKSTICK_Write(unsigned int addr, unsigned char value) |
DESCRIPTION |
writes a byte into BankStick. If verify mode has been enabled with MIOS_BANKSTICK_CtrlSet, write access will be skipped if content is equal to the byte which should be written Returned Error Status: 0x00: no error 0x01: byte mismatch (write failed) -- only set if verify enabled 0x02: BankStick not available |
C_IN |
byte in <value>, address in <addr> (0x0000-0xffff) |
C_OUT |
error status MIOS_BOX_STAT.BS_AVAILABLE cleared if write failed |
C_EXAMPLE |
unsigned char error = 0;
// write 0x47 0x11 to address 0x3000-0x3001 of the BankStick
error |= MIOS_BANKSTICK_Write(0x3000, 0x47);
error |= MIOS_BANKSTICK_Write(0x3001, 0x11);
if( error ) {
// here you could do some error handling
}
|
Back to the top |
MIOS_BANKSTICK_WritePage |
C_DECLARATION |
unsigned char MIOS_BANKSTICK_WritePage(unsigned int addr, unsigned char *buffer) |
DESCRIPTION |
writes a 64 bytes page into BankStick. If verify mode has been enabled with MIOS_BANKSTICK_CtrlSet, write access will be skipped if content is equal to the byte which should be written Returned Error Status: 0x00: no error 0x01: byte mismatch (write failed) -- only set if verify enabled 0x02: BankStick not available |
C_IN |
pointer to write buffer (64 bytes) in <buffer> address in <addr> (0x0000-0xffc0) |
C_OUT |
error status in WREG MIOS_BOX_STAT.BS_AVAILABLE is cleared if write failed |
C_EXAMPLE |
unsigned char buffer[64];
unsigned char i;
// fill buffer with some bytes
for(i=0; i<64; ++i)
buffer[i] = i;
// write a page of 64 bytes to BankStick memory at address 0x3000
if( MIOS_BANKSTICK_WritePage(0x3000, buffer) ) {
// here you could do some error handling
}
|
Back to the top |
MIOS_IIC_AckSend |
C_DECLARATION |
void MIOS_IIC_AckSend |
DESCRIPTION |
sends a ACK (acknowledge) to the slave(s) |
C_IN |
- |
C_OUT |
- |
C_EXAMPLE |
see MIOS_IIC_ByteSend and MIOS_IIC_ByteReceive
|
Back to the top |
MIOS_IIC_ByteReceive |
C_DECLARATION |
unsigned char MIOS_IIC_ByteReceive(void) |
DESCRIPTION |
receives a byte from a IIC slave. |
C_IN |
- |
C_OUT |
received byte in WREG |
C_EXAMPLE |
// receive three bytes from the IIC slave with ID 0x12
MIOS_IIC_Start(); // start IIC
MIOS_IIC_ByteSend(0x12 | 1); // send device address -
// set bit #0 to notify a read!!!
// don't continue if IIC device not available
if( MIOS_BOX_STAT.BS_AVAILABLE ) {
b0 = MIOS_IIC_ByteReceive(); // read first byte
MIOS_IIC_AckSend(); // send acknowledge
b1 = MIOS_IIC_ByteReceive(); // read second byte
MIOS_IIC_AckSend(); // send acknowledge
b2 = MIOS_IIC_ByteReceive(); // read third byte
}
MIOS_IIC_NakSend(); // send disacknowledge!!!
MIOS_IIC_Stop(); // stop IIC
For more details about the IIC protocol (officially called I2C), see
http://www.semiconductors.philips.com/buses/i2c/
|
Back to the top |
MIOS_IIC_ByteSend |
C_DECLARATION |
void MIOS_IIC_ByteSend(unsigned char b) |
DESCRIPTION |
sends a byte over the IIC bus and checks for acknowledge. If the slave didn't send an acknowledge, the (MIOS_BOX_STAT_)BS_AVAILABLE flag in MIOS_BOX_STAT will be cleared. |
C_IN |
byte which should be sent in <b> |
C_OUT |
returns 0x00 if NAK has been received, otherwise != 0x00 due to compatibility reasons, mios_box_stat.BS_AVAILABLE is set so long ACK is received |
C_EXAMPLE |
// send 0x34, 0x56, 0x78 to the IIC slave with ID 0x12
MIOS_IIC_Start(); // start IIC
MIOS_IIC_ByteSend(0x12); // send device address
// bit #0 cleared to notify a write!!!
MIOS_IIC_ByteSend(0x34); // send first data byte
MIOS_IIC_ByteSend(0x56); // send second data byte
MIOS_IIC_ByteSend(0x78); // send third data byte
MIOS_IIC_Stop(); // stop IIC
For more details about the IIC protocol (officially called I2C), see
http://www.semiconductors.philips.com/buses/i2c/
An enhanced example with retry on NAK's can be
found at the MBHP_IIC_MIDI page
|
Back to the top |
MIOS_IIC_CtrlGet |
C_DECLARATION |
unsigned char MIOS_IIC_CtrlGet(void) |
DESCRIPTION |
returns the IIC control status |
C_IN |
- |
C_OUT |
bit 0 if return value: clock stretching enabled |
Back to the top |
MIOS_IIC_CtrlSet |
C_DECLARATION |
void MIOS_IIC_CtrlSet(unsigned char ctrl) |
DESCRIPTION |
enables the "clock stretching" like specified in the IIC specification http://www.semiconductors.philips.com/buses/i2c/ which is required for some IIC slaves which cannot service the bus immediately on a request. |
C_IN |
<ctrl> = 0x00: clock stretching disabled <ctrl> = 0x01: clock stretching enabled |
NOTE |
if enabled, you have to add a 1k pull-up resistor to the SCL line (Pin #22 of the PIC) |
C_EXAMPLE |
// enable clock stretching
MIOS_IIC_CtrlSet(0x01);
|
Back to the top |
MIOS_IIC_NakSend |
C_DECLARATION |
void MIOS_IIC_NakSend(void) |
DESCRIPTION |
sends a NAK (not acknowledge) to the slave(s) |
C_IN |
- |
C_OUT |
- |
C_EXAMPLE |
see MIOS_IIC_ByteSend and MIOS_IIC_ByteReceive
|
Back to the top |
MIOS_IIC_Start |
C_DECLARATION |
void MIOS_IIC_Start(void) |
DESCRIPTION |
sends the IIC start condition (SCL=1, SDA 1->0) |
C_IN |
- |
C_OUT |
- |
C_EXAMPLE |
see MIOS_IIC_ByteSend and MIOS_IIC_ByteReceive
|
Back to the top |
MIOS_IIC_Stop |
C_DECLARATION |
void MIOS_IIC_Stop(void) |
DESCRIPTION |
sends the IIC stop condition (SCL=0->1, SDA 0->1) |
C_IN |
- |
C_OUT |
- |
C_EXAMPLE |
see MIOS_IIC_ByteSend and MIOS_IIC_ByteReceive
|
Back to the top |
MIOS_TIMER_Init |
C_DECLARATION |
void MIOS_TIMER_Init(unsigned char mode, unsigned int period) |
DESCRIPTION |
initializes the timer which calls USER_Timer periodically and starts it. The resolution of the timer is 100nS with Prescaler 1:1, 200nS with 1:2, 400nS with 1:4, 800nS with 1:8. The period (number of clocks) is specified as 16 bit value. |
C_IN |
prescaler value in <mode>: 0x00: 1:1 0x01: 1:2 0x02: 1:4 0x03: 1:8 number of ticks (0..65535) in <period> |
C_OUT |
- |
C_EXAMPLE |
// we want to setup the timer with a frequency of 500 Hz = 2 mS
// prescaler 1:1 should be used
// calculate the required number of clocks for this period:
// clocks = period / 100 nS = 2 mS / 100 nS = 20000
// therefore:
MIOS_TIMER_Init(0x00, 20000);
// now the Timer() function is called every 2 mS!
|
Back to the top |
MIOS_TIMER_ReInit |
C_DECLARATION |
void MIOS_TIMER_ReInit(unsigned char mode, unsigned int period) |
DESCRIPTION |
same like MIOS_TIMER_Init, but the timer won't be reset to allow a smooth re-initialization |
C_IN |
prescaler value in <mode>: 0x00: 1:1 0x01: 1:2 0x02: 1:4 0x03: 1:8 number of ticks (0..65535) in <period> |
C_OUT |
- |
Back to the top |
MIOS_TIMER_Start |
C_DECLARATION |
void MIOS_TIMER_Start(void) |
DESCRIPTION |
(re)starts the timer if it has been stopped before |
Back to the top |
MIOS_TIMER_Stop |
C_DECLARATION |
void MIOS_TIMER_Stop(void) |
DESCRIPTION |
stops the timer |
Back to the top |
MIOS_HLP_16bitAddSaturate |
C_DECLARATION |
unsigned char MIOS_HLP_16bitAddSaturate(unsigned char add_value, unsigned int *ptr, unsigned int max_value) |
DESCRIPTION |
adds a signed 8-bit value to a 16 bit value and saturates That means: if the resulting value is greater than the given max value, the result will be saturated to the max value. If the resulting value is less than 0, the result will be saturated to 0 Important: the 16-bit value must be aligned to an even word address (0x10, 0x12, 0x14, ...). First address contains the low-byte and the second address contains the high-byte |
C_IN |
8-bit signed value in <add_value> pointer to variable which should be modified in <ptr> max value in <max_value> |
C_OUT |
writes new absolute value into *ptr returns 1, if the value has been changed, 0 if it is equal to the old value |
C_EXAMPLE |
// subtract -5 from the 16-bit value (unsigned int)
MIOS_HLP_16bitAddSaturate(-5, &value, 0x0fff);
|
Back to the top |
MIOS_HLP_AddressFromTable |
C_DECLARATION |
not available in C |
DESCRIPTION |
this help function reads a pointer from a table and moves it to TBLPTR. On this way linked lists can be realized |
NOTE |
TBLPTRU not read or changed. Table should be located within a 64k segment! |
Back to the top |
MIOS_HLP_Dec2BCD |
C_DECLARATION |
void MIOS_HLP_Dec2BCD(unsigned int value) |
DESCRIPTION |
converts a 16-bit decimal value to BCD |
C_IN |
16bit value in <value> |
C_OUT |
rightmost digits (n1*10^1 and n0*10^0) in MIOS_PARAMETER1 middle digits (n3*10^3 and n2*10^2) in MIOS_PARAMETER2 leftmost digit (n5*10^4) in MIOS_PARAMETER3 |
C_EXAMPLE |
// get the BCD code from 12345
MIOS_HLP_Dec2BCD(12345);
// now:
// MIOS_PARAMETER3 contains the hex-value 0x01
// MIOS_PARAMETER2 contains the hex-value 0x23
// MIOS_PARAMETER1 contains the hex-value 0x45
|
Back to the top |
MIOS_HLP_GetBitANDMask |
C_DECLARATION |
unsigned char MIOS_HLP_GetBitANDMask(unsigned char value) |
DESCRIPTION |
this help function is usefull for bit manipulations |
C_IN |
see map below |
C_OUT |
0x00 -> 0b11111110 0x01 -> 0b11111101 0x02 -> 0b11111011 0x03 -> 0b11110111 0x04 -> 0b11101111 0x05 -> 0b11011111 0x06 -> 0b10111111 0x07 -> 0b01111111 |
Back to the top |
MIOS_HLP_GetBitORMask |
C_DECLARATION |
unsigned char MIOS_HLP_GetBitORMask(unsigned char value); |
DESCRIPTION |
this help function is usefull for bit manipulations |
C_IN |
see map below |
C_OUT |
0x00 -> 0b00000001 0x01 -> 0b00000010 0x02 -> 0b00000100 0x03 -> 0b00001000 0x04 -> 0b00010000 0x05 -> 0b00100000 0x06 -> 0b01000000 0x07 -> 0b10000000 |
Back to the top |
MIOS_HLP_GetIndex_2bytes |
C_DECLARATION |
not available in C |
DESCRIPTION |
this help function can be used for jumptables which contain 2-byte instructions (-> rgoto). Note that the JUMPTABLE_2BYTES macro allows to use this function securely without the danger that the code behind the table will be executed if the index number in WREG is greater than the number of entries |
Back to the top |
MIOS_HLP_GetIndex_4bytes |
C_DECLARATION |
not available in C |
DESCRIPTION |
this help function can be used for jumptables which contain 4-byte instructions (-> goto). Note that the JUMPTABLE_4BYTES macro allows to use this function securely without the danger that the code behind the table will be executed if the index number in WREG is greater than the number of entries |
Back to the top |
MIOS_HLP_IndirectJump |
C_DECLARATION |
not available in C |
DESCRIPTION |
this help function reads a pointer from a table and jumps to this pointer |
NOTE |
TBLPTRU not read or changed. Table and target address should be located within a 64k segment! |
Back to the top |
MIOS_Delay |
C_DECLARATION |
void MIOS_Delay(unsigned char delay) |
DESCRIPTION |
waits for an exact time note that this function will not work within an interrupt service routine! |
C_IN |
time in ms (0-255) |
C_OUT |
- |
C_EXAMPLE |
// wait for exact 250 ms
MIOS_Delay(250);
|
Back to the top |
MIOS_GPCounterGet |
C_DECLARATION |
unsigned char MIOS_GPCounterGet(void) |
DESCRIPTION |
get value of general purpose counter, which is incremented every millisecond |
C_IN |
- |
C_OUT |
value of general purpose counter |
Back to the top |
MIOS_Reset |
C_DECLARATION |
void MIOS_Reset(void) |
DESCRIPTION |
waits until the Tx MIDI buffer is empty, thereafter resets the OS |
C_IN |
- |
C_OUT |
- |
Back to the top |
MIOS_SystemResume |
C_DECLARATION |
void MIOS_SystemResume(void) |
DESCRIPTION |
resumes all system tasks |
C_IN |
- |
C_OUT |
- |
Back to the top |
MIOS_SystemSuspend |
C_DECLARATION |
void MIOS_SystemSuspend(void) |
DESCRIPTION |
suspends all system and user tasks except for the IO MIDI handler |
C_IN |
- |
C_OUT |
- |
Back to the top |
MIOS_UserResume |
C_DECLARATION |
void MIOS_UserResume(void) |
DESCRIPTION |
resumes all user tasks |
C_IN |
- |
C_OUT |
- |
Back to the top |
MIOS_UserSuspend |
C_DECLARATION |
void MIOS_UserSuspend(void) |
DESCRIPTION |
suspends all user tasks |
C_IN |
- |
C_OUT |
- |
Back to the top |
USER_AIN_NotifyChange |
C_DECLARATION |
void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) |
DESCRIPTION |
This function is called by MIOS when a pot has been moved |
C_IN |
Pot number in <pin> 10bit value in <pin_value> |
ISR |
no |
Back to the top |
USER_DIN_NotifyToggle |
C_DECLARATION |
void DIN_NotifyToggle(unsigned char pin, unsigned char pin_value) |
DESCRIPTION |
This function is called by MIOS when an button has been toggled |
C_IN |
Button number in <pin> Button value <pin_value>: - 1 if button has been released (=5V) - 0 if button has been pressed (=0V) |
ISR |
no |
Back to the top |
USER_DISPLAY_Init |
C_DECLARATION |
void DISPLAY_Init(void) |
DESCRIPTION |
This function is called by MIOS when the display content should be initialized. Thats the case during startup and after a temporary message has been printed on the screen |
C_IN |
- |
C_OUT |
- |
ISR |
no |
Back to the top |
USER_DISPLAY_Tick |
C_DECLARATION |
void DISPLAY_Tick(void) |
DESCRIPTION |
This function is called by MIOS in the mainloop when no temporary message is shown on the screen. |
C_IN |
- |
C_OUT |
- |
ISR |
no |
Back to the top |
USER_ENC_NotifyChange |
C_DECLARATION |
void ENC_NotifyChange(unsigned char encoder, char incrementer) |
DESCRIPTION |
This function is called by MIOS when an encoder has been moved |
C_IN |
Encoder number in <encoder> signed incrementer value in <incrementer> - is positive when encoder has been turned clockwise - is negative when encoder has been turned counter clockwise |
ISR |
no |
Back to the top |
USER_Init |
C_DECLARATION |
void Init(void) |
DESCRIPTION |
This function is called by MIOS after startup to initialize the application |
C_IN |
- |
C_OUT |
- |
ISR |
no |
Back to the top |
USER_LCD_Clear |
C_DECLARATION |
not available in C - code is part of LCD driver (app_lcd.inc) |
DESCRIPTION |
This function is called by MIOS when the custom LCD should be cleared |
NOTE |
see the custom_lcd_example for further details |
Back to the top |
USER_LCD_Cmd |
C_DECLARATION |
not available in C - code is part of LCD driver (app_lcd.inc) |
DESCRIPTION |
sends a command to the LCD display. On CLCDs: use this function to decode the HD44780 commands if required On GLCDs: ignore this function! |
NOTE |
see the custom_lcd_example for further details |
Back to the top |
USER_LCD_CursorSet |
C_DECLARATION |
not available in C - code is part of LCD driver (app_lcd.inc) |
DESCRIPTION |
This function is called by MIOS when the cursor should be changed |
NOTE |
see the custom_lcd_example for further details |
Back to the top |
USER_LCD_Data |
C_DECLARATION |
not available in C - code is part of LCD driver (app_lcd.inc) |
DESCRIPTION |
sends a data value to the LCD display. On CLCDs: branch directly to USER_LCD_PrintChar On GLCDs: ignore this function! |
NOTE |
see the custom_lcd_example for further details |
Back to the top |
USER_LCD_Init |
C_DECLARATION |
not available in C - code is part of LCD driver (app_lcd.inc) |
DESCRIPTION |
This function is called by MIOS when the custom LCD should be initialized |
NOTE |
see the custom_lcd_example for further details |
Back to the top |
USER_LCD_PrintChar |
C_DECLARATION |
not available in C - code is part of LCD driver (app_lcd.inc) |
DESCRIPTION |
This function is called by MIOS when a character should be print |
NOTE |
see the custom_lcd_example for further details |
Back to the top |
USER_LCD_SpecialCharInit |
C_DECLARATION |
not available in C - code is part of LCD driver (app_lcd.inc) |
DESCRIPTION |
see MIOS_CLCD_SpecialCharInit |
NOTE |
see the custom_lcd_example for further details |
Back to the top |
USER_MIDI_NotifyRx |
C_DECLARATION |
not available in C - code has to be added to mios_wrapper |
DESCRIPTION |
This function is called by MIOS when a MIDI byte has been received. It can be used to monitor the Rx activity or to do any action - e.g. to react on realtime events like MIDI clock (0xf8) with a minimum latency. Note that this is an interrupt service routine! Use FSR2 instead of FSR0 and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible! |
ISR |
yes |
Back to the top |
USER_MIDI_NotifyTx |
C_DECLARATION |
not available in C - code has to be added to mios_wrapper |
DESCRIPTION |
This function is called by MIOS before the transfer of a MIDI byte. It can be used to monitor the Tx activity or to do any other actions (e.g. to switch a pin for multiplexed MIDI Outs) before the byte will be sent. Note that this is an interrupt service routine! Use FSR2 instead of FSR0 and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible! |
ISR |
yes |
Back to the top |
USER_MPROC_DebugTrigger |
C_DECLARATION |
not available in C - code has to be added to mios_wrapper |
DESCRIPTION |
This function is called by MIOS when a debug command has been received via SysEx |
ISR |
no |
Back to the top |
USER_MPROC_NotifyFoundEvent |
C_DECLARATION |
void MPROC_NotifyFoundEvent(unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) |
DESCRIPTION |
This function is called by MIOS when a MIDI event has been received which has been specified in the CONFIG_MIDI_IN table |
C_IN |
first MIDI event byte in <evnt0> second MIDI event byte in <evnt1> third MIDI event byte in <evnt2> |
C_OUT |
- |
ISR |
no |
Back to the top |
USER_MPROC_NotifyReceivedByte |
C_DECLARATION |
void MPROC_NotifyReceivedByte(unsigned char byte) |
DESCRIPTION |
This function is called by MIOS when a MIDI byte has been received |
C_IN |
received MIDI byte in <byte> |
C_OUT |
- |
ISR |
no |
Back to the top |
USER_MPROC_NotifyReceivedEvent |
C_DECLARATION |
void MPROC_NotifyReceivedEvent(unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) |
DESCRIPTION |
This function is called by MIOS when a complete MIDI event has been received |
C_IN |
first MIDI event byte in <evnt0> second MIDI event byte in <evnt1> third MIDI event byte in <evnt2> |
C_OUT |
- |
ISR |
no |
Back to the top |
USER_MPROC_NotifyTimeout |
C_DECLARATION |
void MPROC_NotifyTimeout(void) |
DESCRIPTION |
This function is called by MIOS when a MIDI event has not been completly received within 2 seconds |
C_IN |
- |
C_OUT |
- |
ISR |
no |
Back to the top |
USER_SR_Service_Finish |
C_DECLARATION |
void SR_Service_Finish(void) |
DESCRIPTION |
This function is called by MIOS after the shift register have been loaded. Note that this is an interrupt service routine! Use FSR2 instead of FSR0 and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible! |
C_IN |
- |
C_OUT |
- |
ISR |
yes |
Back to the top |
USER_SR_Service_Prepare |
C_DECLARATION |
void SR_Service_Prepare(void) |
DESCRIPTION |
This function is called by MIOS before the shift register are loaded. Note that this is an interrupt service routine! Use FSR2 instead of FSR0 and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible! |
C_IN |
- |
C_OUT |
- |
ISR |
yes |
Back to the top |
USER_Tick |
C_DECLARATION |
void Tick(void) |
DESCRIPTION |
This function is called by MIOS in the mainloop when nothing else is to do |
C_IN |
- |
C_OUT |
- |
ISR |
no |
Back to the top |
USER_Timer |
C_DECLARATION |
void Timer(void) |
DESCRIPTION |
This function is periodically called by MIOS. The frequency has to be initialized with MIOS_Timer_Set Note that this is an interrupt service routine! Use FSR2 instead of FSR0 and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible! |
C_IN |
- |
C_OUT |
- |
ISR |
yes |
Back to the top |

Last update: 2015-09-24
Copyright © 1998-2015, Thorsten Klose. All rights reserved.
|