# format

Writes formatted values to output device

Author | Stef Mientki, Copyright © 2002 .. 2006, all rights reserved.
Adapted-by | Joep Suijs, Albert Faber, Eur van Andel
Compiler | >=2.2

Description

    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)

Dependencies

No dependency found

## Summary

### Global variables/contants

- `var bit _format_signed = false`
- `var byte _format_digit`
- `var byte _format_leader`
- `var byte _format_sign`

### Procedures

- `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)`

Private

- `_write_real_digit(volatile byte out device)`
- `_write_digit(volatile byte out device, byte in digit, bit in point)`

### Functions

## API details

### Global variables/contants

- `var bit _format_signed = false`

  No documentation found

- `var byte _format_digit`

  No documentation found

- `var byte _format_leader`

      global vars

- `var byte _format_sign`

  No documentation found

### Procedures

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

Private

- `_write_real_digit(volatile byte out device)`

- `_write_digit(volatile byte out device, byte in digit, bit in point)`

### Functions

## Related samples

Here are the list of samples which use this library:

16f18857 | 16f18857_glcd_ili9341_fat32_sd_card.jal
16f648a | 16f648a_serial_print.jal
16f648a | 16f648a_serial_format.jal
16f648a | 16f648a_ds18b20_single.jal
16f723 | 16f723_serial_print.jal
16f723 | 16f723_serial_format.jal
16f73 | 16f73_temperature_tc77.jal
16f73 | 16f73_serial_print.jal
16f73 | 16f73_serial_software.jal
16f73 | 16f73_serial_format.jal
16f819 | 16f819_ee25aa02e48_lcd.jal
16f819 | 16f819_mcp2515_can_monitor.jal
16f819 | 16f819_mcp2515_canid4_monitor.jal
16f876a | 16f876a_rtc_timeset.jal
16f876a | 16f876a_humidity_sht.jal
16f876a | 16f876a_rtc_lcd.jal
16f876a | 16f876a_tc77.jal
16f877 | 16f877_temperature_tc77.jal
16f877 | 16f877_serial_format.jal
16f877 | 16f877_serial_print.jal
16f877 | 16f877_serial_software.jal
16f877 | 16f877_ds18b20_single.jal
16f877a | 16f877a_rtc_pcf8563.jal
16f877a | 16f877a_lcd_format.jal
16f877a | 16f877a_ds1307_sw.jal
16f877a | 16f877a_serial_software.jal
16f877a | 16f877a_ds1307_hw.jal
16f877a | 16f877a_serial_format.jal
16f877a | 16f877a_serial_print.jal
16f877a | 16f877a_rtc_lcd.jal
16f877a | 16f877a_ds18b20_single.jal
16f877a | 16f877a_rtc_timeset.jal
16f877a | 16f877a_temperature_tc77.jal
16f88 | 16f88_temperature_tc77.jal
16f88 | 16f88_ds18b20_single.jal
16f88 | 16f88_serial_format.jal
16f88 | 16f88_serial_print.jal
16f88 | 16f88_serial_software.jal
16f886 | 16f886_rtc_lcd_4mhz.jal
16f886 | 16f886_rtc_lcd_125khz.jal
16f886 | 16f886_rtc_lcd_20mhz.jal
16f886 | 16f886_pwm_adc_freq.jal
16f886 | 16f886_pwm_adc_res.jal
18f14k50 | 18f14k50_temperature_tc77.jal
18f14k50 | 18f14k50_serial_format.jal
18f14k50 | 18f14k50_pll.jal
18f14k50 | 18f14k50_serial_print.jal
18f2450 | 18f2450_ds18b20_single.jal
18f2450 | 18f2450_serial_print.jal
18f2450 | 18f2450_serial_format.jal
18f2520 | 18f2520_serial_print.jal
18f2520 | 18f2520_temperature_tc77.jal
18f2520 | 18f2520_serial_format.jal
18f2550 | 18f2550_serial_format.jal
18f2550 | 18f2550_serial_print.jal
18f2550 | 18f2550_temperature_tc77.jal
18f2585 | 18f2585_can_monitor.jal
18f2585 | 18f2585_1wire_ds1820.jal
18f2585 | 18f2585_canid4_monitor.jal
18f2585 | 18f2585_can_serial_hw.jal
18f2585 | 18f2585_canid4_serial_adapter.jal
18f2585 | 18f2585_can_serial_adapter.jal
18f25j10 | 18f25j10_test_mlx90615.jal
18f2620 | 18f2620_temperature_tc77.jal
18f2620 | 18f2620_rtc_tmr3.jal
18f2620 | 18f2620_serial_format.jal
18f2620 | 18f2620_serial_print.jal
18f26j50 | 18f26j50_fat32_sd_card.jal
18f26j50 | 18f26j50_sd_card.jal
18f27j53 | 18f27j53_dht11.jal
18f452 | 18f452_ds18b20_single.jal
18f452 | 18f452_serial_print.jal
18f452 | 18f452_pressure.jal
18f452 | 18f452_serial_software.jal
18f452 | 18f452_temperature_tc77.jal
18f452 | 18f452_serial_format.jal
18f4550 | 18f4550_temperature_tc77.jal
18f4550 | 18f4550_serial_format.jal
18f4550 | 18f4550_serial_software.jal
18f4550 | 18f4550_ds18b20_single.jal
18f4550 | 18f4550_serial_print.jal
18f4585 | 18f4585_canid4_monitor.jal
18f4620 | 18f4620_accelerometer_gyroscope_bmi160.jal
18f4620 | 18f4620_spi_slave_hw.jal
18f4620 | 18f4620_temperature_tc77.jal
18f4620 | 18f4620_transceiver_cc1101.jal
18f4620 | 18f4620_spi_to_serial.jal
18f4620 | 18f4620_quadrature_counter_ls7366r.jal
18f4620 | 18f4620_serial_format.jal
18f4620 | 18f4620_serial_print.jal
18f4620 | 18f4620_serial_software.jal
18f67j50 | 18f67j50_usb_msd_pata_hard_disk.jal
18f67j50 | 18f67j50_temperature_tc77.jal
18f67j50 | 18f67j50_serial_format.jal
18f67j50 | 18f67j50_fat32_usb_msd_sd_card.jal
18f67j50 | 18f67j50_serial_software.jal
18f67j50 | 18f67j50_fat32_usb_msd_pata_hard_disk.jal
18f67j50 | 18f67j50_serial_print.jal
18f67j50 | 18f67j50_usb_msd_sd_card.jal
18f67j50 | 18f67j50_usb_mouse.jal