appcfg.h File Reference

Application Configuration functions. More...

#include "net\ip.h"

Data Structures

struct  _APP_CONFIG

Defines

#define APPCFG_CMDFLAGS_AUTH_UDP   0x02
#define APPCFG_CMDFLAGS_ENABLE   0x01
#define APPCFG_NETFLAGS_DHCP   0x01
#define APPCFG_SMALLER_256
#define APPCFG_USART_ENABLE   0x01
#define APPCFG_USERNAME_LEN   9
#define APPCFG_WEBFLAGS_AUTH_ALL   0x02
#define APPCFG_WEBFLAGS_AUTH_CGI   0x10
#define APPCFG_WEBFLAGS_AUTH_DYN   0x08
#define APPCFG_WEBFLAGS_AUTH_GET   0x04
#define APPCFG_WEBFLAGS_AUTH_SECTAG   0x20
#define APPCFG_WEBFLAGS_AUTH_X   0x01
#define APPCFG_WEBFLAGS_PARSE_HTM   0x01
#define APPCFG_WEBFLAGS_PARSE_JS   0x02
#define appcfgGetcAtField(field)   appcfgGetc(offsetof(APP_CONFIG, field))
#define appcfgPutc(offset, value)   EEDATA = (value); _appcfgPutc(offset)
#define appcfgPutcAtField(field, value)   EEDATA = (value); _appcfgPutc(offsetof(APP_CONFIG, field))
#define BAUD_115200   8
#define BAUD_1200   1
#define BAUD_19200   5
#define BAUD_230400   9
#define BAUD_2400   2
#define BAUD_300   0
#define BAUD_38400   6
#define BAUD_460800   10
#define BAUD_4800   3
#define BAUD_57600   7
#define BAUD_921600   11
#define BAUD_9600   4
#define BUSCFG_BUS1_TXBUFSIZE   BUSCFG_SER1_TXBUFSIZE
#define pwmIs10BitMode()   (PR2 == 255)
#define pwmIs8BitMode()   (PR2 == 63)
#define XBRD_TYPE_IOR5E   2
#define XBRD_TYPE_MAX   2
#define XBRD_TYPE_MXD2R   1
#define XBRD_TYPE_NONE   0

Typedefs

typedef struct _APP_CONFIG APP_CONFIG

Enumerations

enum  APP_CONFIG_ENUM {
  APPCFG_IP0 = 0, APPCFG_IP1, APPCFG_IP2, APPCFG_IP3,
  APPCFG_MAC0, APPCFG_MAC1, APPCFG_MAC2, APPCFG_MAC3,
  APPCFG_MAC4, APPCFG_MAC5, APPCFG_MASK0, APPCFG_MASK1,
  APPCFG_MASK2, APPCFG_MASK3, APPCFG_GATEWAY0, APPCFG_GATEWAY1,
  APPCFG_GATEWAY2, APPCFG_GATEWAY3, APPCFG_WAIT4BL, APPCFG_FLASH_HAS_PROGRAM,
  APPCFG_STARTUP_SER_DLY, APPCFG_SYSFLAGS, APPCFG_NETFLAGS, APPCFG_SMTP_SRVR_ADR0,
  APPCFG_SMTP_SRVR_ADR1, APPCFG_SMTP_SRVR_ADR2, APPCFG_SMTP_SRVR_ADR3, APPCFG_TFTP_SRVR_ADR0,
  APPCFG_TFTP_SRVR_ADR1, APPCFG_TFTP_SRVR_ADR2, APPCFG_TFTP_SRVR_ADR3, APPCFG_USART1_BAUD,
  APPCFG_USART1_CFG, APPCFG_USART2_BAUD, APPCFG_USART2_CFG, APPCFG_TRISA,
  APPCFG_TRISB, APPCFG_TRISC, APPCFG_TRISD, APPCFG_TRISE,
  APPCFG_TRISF, APPCFG_TRISG, APPCFG_PORTA, APPCFG_PORTB,
  APPCFG_PORTC, APPCFG_PORTD, APPCFG_PORTE, APPCFG_PORTF,
  APPCFG_PORTG, APPCFG_ADCON1, APPCFG_ADCON0_2, APPCFG_SERIAL_NUMBER0,
  APPCFG_SERIAL_NUMBER1, APPCFG_USERNAME0, APPCFG_USERNAME1, APPCFG_USERNAME2,
  APPCFG_USERNAME3, APPCFG_USERNAME4, APPCFG_USERNAME5, APPCFG_USERNAME6,
  APPCFG_USERNAME7, APPCFG_USERNAME8, APPCFG_PASSWORD0, APPCFG_PASSWORD1,
  APPCFG_PASSWORD2, APPCFG_PASSWORD3, APPCFG_PASSWORD4, APPCFG_PASSWORD5,
  APPCFG_PASSWORD6, APPCFG_PASSWORD7, APPCFG_PASSWORD8, APPCFG_NETBIOS0,
  APPCFG_NETBIOS1, APPCFG_NETBIOS2, APPCFG_NETBIOS3, APPCFG_NETBIOS4,
  APPCFG_NETBIOS5, APPCFG_NETBIOS6, APPCFG_NETBIOS7, APPCFG_NETBIOS8,
  APPCFG_NETBIOS9, APPCFG_NETBIOS10, APPCFG_NETBIOS11, APPCFG_NETBIOS12,
  APPCFG_NETBIOS13, APPCFG_NETBIOS14, APPCFG_NETBIOS15, APPCFG_DNS_IP0,
  APPCFG_DNS_IP1, APPCFG_DNS_IP2, APPCFG_DNS_IP3, APPCFG_CMD_UDPPORT0,
  APPCFG_CMD_UDPPORT1, APPCFG_CMD_RESERVED1, APPCFG_CMD_RESERVED2, APPCFG_CMD_RESERVED3,
  APPCFG_CMD_RESERVED4, APPCFG_CMD_RESERVED5, APPCFG_CMD_FLAGS, APPCFG_PWM_ENABLE,
  APPCFG_PWM_FREQ, APPCFG_PWM_FLAGS, APPCFG_PWM_1L, APPCFG_PWM_1H,
  APPCFG_PWM_2L, APPCFG_PWM_2H, APPCFG_PWM_3L, APPCFG_PWM_3H,
  APPCFG_PWM_4L, APPCFG_PWM_4H, APPCFG_PWM_5L, APPCFG_PWM_5H,
  APPCFG_WEB_RESERVED1, APPCFG_WEB_RESERVED2, APPCFG_WEB_FLAGS, APPCFG_WEB_RESERVED3,
  APPCFG_HTTPSRVR_PORTL, APPCFG_HTTPSRVR_PORTH, APPCFG_LCD1_ADR, APPCFG_LCD1_RESERVED1,
  APPCFG_LCD1_RESERVED2, APPCFG_LCD1_RESERVED3, APPCFG_LCD1_RESERVED4, APPCFG_LCD1_RESERVED5,
  APPCFG_EVENT_UDPPORT0, APPCFG_EVENT_UDPPORT1, APPCFG_EVENT_FLAGS, APPCFG_EVENT_RESERVED1,
  APPCFG_EVENT_RESERVED2, APPCFG_EVENT_RESERVED3, APPCFG_EVENT_RESERVED4, APPCFG_EVENT_RESERVED5,
  APPCFG_EVENT_RESERVED6, APPCFG_EVENT_RESERVED7, APPCFG_EVENT_RESERVED8, APPCFG_XBRD_TYPE,
  APPCFG_XBRD_AI_RANGE, APPCFG_XBRD_RESERVED1, APPCFG_XBRD_RESERVED2, APPCFG_XBRD_RESERVED3,
  APPCFG_XBRD_RESERVED4, APPCFG_XBRD_RESERVED5, APPCFG_XBRD_RESERVED6, APPCFG_XBRD_RESERVED7,
  APPCFG_XBRD_RESERVED8
}
enum  BUS_CONFIG_ENUM {
  BUSCFG_SER1_TXBUFSIZE = 256, BUSCFG_SER1_RXBUFSIZE, BUSCFG_SER2_TXBUFSIZE, BUSCFG_SER2_RXBUFSIZE,
  BUSCFG_I2C1_TXBUFSIZE, BUSCFG_I2C1_RXBUFSIZE, BUSCFG_SPI1_TXBUFSIZE, BUSCFG_SPI1_RXBUFSIZE,
  BUSCFG_BUS5_TXBUFSIZE, BUSCFG_BUS5_RXBUFSIZE, BUSCFG_BUS6_TXBUFSIZE, BUSCFG_BUS6_RXBUFSIZE,
  BUSCFG_BUS7_TXBUFSIZE, BUSCFG_BUS7_RXBUFSIZE, BUSCFG_BUS8_TXBUFSIZE, BUSCFG_BUS8_RXBUFSIZE,
  BUSCFG_UDP1_PORT0, BUSCFG_UDP1_PORT1, BUSCFG_UDP1_CFG, BUSCFG_UDP2_PORT0,
  BUSCFG_UDP2_PORT1, BUSCFG_UDP2_CFG, BUSCFG_UDP1_LINK, BUSCFG_UDP2_LINK,
  BUSCFG_SWSPI_ENABLED, BUSCFG_SWSPI1_CLKPIN, BUSCFG_SWSPI1_SDIPIN, BUSCFG_SWSPI1_SDOPIN,
  BUSCFG_SWSPI1_CSPIN, BUSCFG_SWSPI1_CONF
}

Functions

void _appcfgPutc (WORD offset)
void appcfgADC (void)
void appcfgCpuIO (void)
void appcfgCpuIOValues (void)
BYTE appcfgGetc (WORD offset)
void appcfgInit (void)
void appcfgPWM (void)
void appcfgSave (void)
void appcfgUSART (void)
void appcfgUSART2 (void)
void appcfgXboard (void)
void pwmEnable (BYTE chan, BOOL remember)
BYTE pwmGetFreq (void)
WORD pwmGetValue (BYTE ch)
void pwmSetFreq (BYTE freq, BOOL remember)
void pwmSetValue (BYTE ch, WORD_VAL val, BOOL remember)

Variables

APP_CONFIG AppConfig


Detailed Description

Application Configuration functions.

Author:
Modtronix Engineering
Dependencies:
none
Compiler:
MPLAB C18 v2.10 or higher
HITECH PICC-18 V8.35PL3 or higher

Description

For details on application configuration data, see Application Configuration module!

Configuration

The following defines are used to configure this module, and should be placed in the projdefs.h (or similar) file. For details, see Project Configuration. To configure the module, the required defines should be uncommended, and the rest commented out.
 //*******************************************************
 //----------------- Appcfg Configuration -----------------
 //********************************************************
 //Define if this application has an 8 bit ADC converter, 10 bit ADC converter or none at all.
 //#define APP_USE_ADC8
 //#define APP_USE_ADC10

 //Define buffer space that is reserved for ADC conversion values. For a 8 bit ADC converted, 1 byte
 //is reserved per channel. For an 10 bit ADC, 2 bytes are reserved per channel.
 //#define ADC_CHANNELS 12

Define Documentation

#define APPCFG_CMDFLAGS_AUTH_UDP   0x02

#define APPCFG_CMDFLAGS_ENABLE   0x01

Mask for bits in APPCFG_CMD_FLAGS config byte.

#define APPCFG_NETFLAGS_DHCP   0x01

Mask for bits in APPCFG_NETFLAGS config byte.

#define APPCFG_SMALLER_256

Define this if APP_CONFIG is smaller then 256 bytes. When this is defined the code knows that it only need 1 byte to address all configuration bytes. This produces smaller and faster code.

#define APPCFG_USART_ENABLE   0x01

#define APPCFG_USERNAME_LEN   9

#define APPCFG_WEBFLAGS_AUTH_ALL   0x02

#define APPCFG_WEBFLAGS_AUTH_CGI   0x10

#define APPCFG_WEBFLAGS_AUTH_DYN   0x08

#define APPCFG_WEBFLAGS_AUTH_GET   0x04

#define APPCFG_WEBFLAGS_AUTH_SECTAG   0x20

#define APPCFG_WEBFLAGS_AUTH_X   0x01

Mask for bits in APPCFG_WEB_FLAGS config byte.

#define APPCFG_WEBFLAGS_PARSE_HTM   0x01

Mask for bits in APPCFG_WEB_FLAGS2 config byte.

#define APPCFG_WEBFLAGS_PARSE_JS   0x02

#define appcfgGetcAtField ( field   )     appcfgGetc(offsetof(APP_CONFIG, field))

Gets a specified byte from the APP_CONFIG configuration structure

Parameters:
field The byte to get from the APP_CONFIG structure. For example "MyMask.v[0]"
Returns:
Returns the requested byte

#define appcfgPutc ( offset,
value   )     EEDATA = (value); _appcfgPutc(offset)

Set a specified byte in the APP_CONFIG configuration structure to a given value. This function will only update the EEPROM if the given new value is different from the current old value. This saves the EEPROM, and increases it's live!

Parameters:
offset The byte to set in the APP_CONFIG structure. Use the APPCFG_X defines
value Contains the value to set the given byte to
Returns:
Returns the requested byte

#define appcfgPutcAtField ( field,
value   )     EEDATA = (value); _appcfgPutc(offsetof(APP_CONFIG, field))

Set a specified byte from the APP_CONFIG configuration structure to a given value.

Parameters:
field The byte to set in the APP_CONFIG structure. For example "MyMask.v[0]"
value Contains the value to set the given byte to
Returns:
Returns the requested byte

#define BAUD_115200   8

#define BAUD_1200   1

#define BAUD_19200   5

#define BAUD_230400   9

#define BAUD_2400   2

#define BAUD_300   0

#define BAUD_38400   6

#define BAUD_460800   10

#define BAUD_4800   3

#define BAUD_57600   7

#define BAUD_921600   11

#define BAUD_9600   4

#define BUSCFG_BUS1_TXBUFSIZE   BUSCFG_SER1_TXBUFSIZE

 
#define pwmIs10BitMode (  )     (PR2 == 255)

Return TRUE if the PWM is currently in 10-bit mode

 
#define pwmIs8BitMode (  )     (PR2 == 63)

Return TRUE if the PWM is currently in 10-bit mode

#define XBRD_TYPE_IOR5E   2

#define XBRD_TYPE_MAX   2

#define XBRD_TYPE_MXD2R   1

#define XBRD_TYPE_NONE   0


Typedef Documentation

typedef struct _APP_CONFIG APP_CONFIG

Structure for storing application configuration data that needs fast access. This structure is created in the processors internal RAM, and is initialized with the contents of the corresponding bytes in EEPROM at startup. Whenever the application needs to access any of these variables, it will read them straight from this RAM structure in stead of reading them from the EEPROM.


Enumeration Type Documentation

Main application config structure. This structure lives in the internal EEPROM, starting at address 0.
!!! IMPORTANT - Only add to end the of this structure!!!
This structure can NOT get larger then 256 bytes. If it does, some code will have to be changed!

Enumerator:
APPCFG_IP0  Our IP address. First entry is MSB byte of IP address, for example in "192.168.1.0" it will be 192.
Offset = 0 = 0x00.
APPCFG_IP1  Offset = 1 = 0x01.
APPCFG_IP2  Offset = 2 = 0x02.
APPCFG_IP3  Offset = 3 = 0x03.


Our MAC address. First entry is MSB byte of MAC address
APPCFG_MAC0  Offset = 4 = 0x04.
APPCFG_MAC1  Offset = 5 = 0x05.
APPCFG_MAC2  Offset = 6 = 0x06.
APPCFG_MAC3  Offset = 7 = 0x07.
APPCFG_MAC4  Offset = 8 = 0x08.
APPCFG_MAC5  Offset = 9 = 0x09.


Our Subnet Mask. First entry is MSB of MASK address, for example if mask is 255.0.0.0 it will be 255
APPCFG_MASK0  Offset = 10 = 0x0A.
APPCFG_MASK1  Offset = 11 = 0x0B.
APPCFG_MASK2  Offset = 12 = 0x0C.
APPCFG_MASK3  Offset = 13 = 0x0D.


Our Gateway address. First entry is MSB byte of IP address, for example in "192.168.1.254" it will be 192
APPCFG_GATEWAY0  Offset = 14 = 0x0E.
APPCFG_GATEWAY1  Offset = 15 = 0x0F.
APPCFG_GATEWAY2  Offset = 16 = 0x10.
APPCFG_GATEWAY3  Offset = 17 = 0x11.


Bootloader Startup Delay. This is how long the bootloader will run after reset, value from 0-n. Time = 0.8sec x n
APPCFG_WAIT4BL  Offset = 18 = 0x12.


If 0, the FLASH has not been programmed yet, or does NOT contain a valid program. In this case we can not exit bootloader mode!
APPCFG_FLASH_HAS_PROGRAM  Offset = 19 = 0x13.


Time to delay on startup(n x 50ms), and give chance to press key and enter serial config. If 0, skip
APPCFG_STARTUP_SER_DLY  Offset = 20 = 0x14.


System Flags
  • Bit 0: 4 x PLL enable flag
  • Bit 1: Blink led on B6
APPCFG_SYSFLAGS  Offset = 21 = 0x15.


Network Flags
  • Bit 0: DHCP enable flag
APPCFG_NETFLAGS  Offset = 22 = 0x16.


SMTP Server address
APPCFG_SMTP_SRVR_ADR0  Offset = 23 = 0x17.
APPCFG_SMTP_SRVR_ADR1  Offset = 24 = 0x18.
APPCFG_SMTP_SRVR_ADR2  Offset = 25 = 0x19.
APPCFG_SMTP_SRVR_ADR3  Offset = 26 = 0x1A.


TFTP Server address
APPCFG_TFTP_SRVR_ADR0  Offset = 27 = 0x1B.
APPCFG_TFTP_SRVR_ADR1  Offset = 28 = 0x1C.
APPCFG_TFTP_SRVR_ADR2  Offset = 29 = 0x1D.
APPCFG_TFTP_SRVR_ADR3  Offset = 30 = 0x1E.


USART1 Baud rate will be a BAUD_XXX define
APPCFG_USART1_BAUD  Offset = 31 = 0x1F.


USART1 Configuration
  • Bit 0: USART1 Enable
APPCFG_USART1_CFG  Offset = 32 = 0x20.


USART2 Baud rate will be a BAUD_XXX define
APPCFG_USART2_BAUD  Offset = 33 = 0x21.


USART2 Configuration
  • Bit 0: USART2 Enable
APPCFG_USART2_CFG  Offset = 34 = 0x22.



Port Direction configuration
APPCFG_TRISA  Offset = 35 = 0x23.
APPCFG_TRISB  Offset = 36 = 0x24.
APPCFG_TRISC  Offset = 37 = 0x25.
APPCFG_TRISD  Offset = 38 = 0x26.
APPCFG_TRISE  Offset = 39 = 0x27.
APPCFG_TRISF  Offset = 40 = 0x28.
APPCFG_TRISG  Offset = 41 = 0x29.


Port Default Values
APPCFG_PORTA  Offset = 42 = 0x2A.
APPCFG_PORTB  Offset = 43 = 0x2B.
APPCFG_PORTC  Offset = 44 = 0x2C.
APPCFG_PORTD  Offset = 45 = 0x2D.
APPCFG_PORTE  Offset = 46 = 0x2E.
APPCFG_PORTF  Offset = 47 = 0x2F.
APPCFG_PORTG  Offset = 48 = 0x30.


ADC configuration
APPCFG_ADCON1  Offset = 49 = 0x31.
APPCFG_ADCON0_2  Offset = 50 = 0x32.


Serial Number
APPCFG_SERIAL_NUMBER0  Offset = 51 = 0x33.
APPCFG_SERIAL_NUMBER1  Offset = 52 = 0x34.


Username - Is a null terminated string. Max 8 char + null termination char
APPCFG_USERNAME0  Offset = 53 = 0x35.
APPCFG_USERNAME1  Offset = 54 = 0x36.
APPCFG_USERNAME2  Offset = 55 = 0x37.
APPCFG_USERNAME3  Offset = 56 = 0x38.
APPCFG_USERNAME4  Offset = 57 = 0x39.
APPCFG_USERNAME5  Offset = 58 = 0x3A.
APPCFG_USERNAME6  Offset = 59 = 0x3B.
APPCFG_USERNAME7  Offset = 60 = 0x3C.
APPCFG_USERNAME8  Offset = 61 = 0x3D.


Password - Is a null terminated string. Max 8 char + null termination char
APPCFG_PASSWORD0  Offset = 62 = 0x3E.
APPCFG_PASSWORD1  Offset = 63 = 0x3F.
APPCFG_PASSWORD2  Offset = 64 = 0x40.
APPCFG_PASSWORD3  Offset = 65 = 0x41.
APPCFG_PASSWORD4  Offset = 66 = 0x42.
APPCFG_PASSWORD5  Offset = 67 = 0x43.
APPCFG_PASSWORD6  Offset = 68 = 0x44.
APPCFG_PASSWORD7  Offset = 69 = 0x45.
APPCFG_PASSWORD8  Offset = 70 = 0x46.


NetBIOS Name - Is a 16 character name, all in uppercase
APPCFG_NETBIOS0  Offset = 71 = 0x47.
APPCFG_NETBIOS1  Offset = 72 = 0x48.
APPCFG_NETBIOS2  Offset = 73 = 0x49.
APPCFG_NETBIOS3  Offset = 74 = 0x4A.
APPCFG_NETBIOS4  Offset = 75 = 0x4B.
APPCFG_NETBIOS5  Offset = 76 = 0x4C.
APPCFG_NETBIOS6  Offset = 77 = 0x4D.
APPCFG_NETBIOS7  Offset = 78 = 0x4E.
APPCFG_NETBIOS8  Offset = 79 = 0x4F.
APPCFG_NETBIOS9  Offset = 80 = 0x50.
APPCFG_NETBIOS10  Offset = 81 = 0x51.
APPCFG_NETBIOS11  Offset = 82 = 0x52.
APPCFG_NETBIOS12  Offset = 83 = 0x53.
APPCFG_NETBIOS13  Offset = 84 = 0x54.
APPCFG_NETBIOS14  Offset = 85 = 0x55.
APPCFG_NETBIOS15  Offset = 86 = 0x56.


Primary DNS Server. First entry is MSB byte of IP address, for example in "192.168.1.0" it will be 192
APPCFG_DNS_IP0  Offset = 87 = 0x57.
APPCFG_DNS_IP1  Offset = 88 = 0x58.
APPCFG_DNS_IP2  Offset = 89 = 0x59.
APPCFG_DNS_IP3  Offset = 90 = 0x5A.


UDP Command Port
APPCFG_CMD_UDPPORT0  Offset = 91 = 0x5B.
APPCFG_CMD_UDPPORT1  Offset = 92 = 0x5C.


UDP reserved bytes
APPCFG_CMD_RESERVED1  Offset = 93 = 0x5D.
APPCFG_CMD_RESERVED2  Offset = 94 = 0x5E.
APPCFG_CMD_RESERVED3  Offset = 95 = 0x5F.
APPCFG_CMD_RESERVED4  Offset = 96 = 0x60.
APPCFG_CMD_RESERVED5  Offset = 97 = 0x61.


Command Flags
  • Bit 0: Enable UDP Commands. When set, UDP command are enabled.
  • Bit 1: Authentication required for UDP Commands. When set, each UDP command must start with the username and password, seperated with a ':' character. Following this must be a space, and then the commands.
APPCFG_CMD_FLAGS  Offset = 98 = 0x62.


PWM Channel 1-8 Enable Register. 0=off, 1=on. All Off by default. The LSB (bit 0) controls PWM Channel 1.
APPCFG_PWM_ENABLE  Offset = 99 = 0x63.


PWM Frequency for all channels. The frequency is different for 8 bit 10 bit mode!
Frequencies when in 10 bit mode:
- 0 = 2.441 kHz
- 1 = 9.766 kHz
- 2 and 3 = 39.062 kHz
Frequencies when in 8 bit mode:
- 0 and 1 = 9.766 kHz
- 2 = 39.062 kHz
- 3 = 156.25 kHz
APPCFG_PWM_FREQ  Offset = 100 = 0x64.


PWM Flags:
  • Bit 0: Configures for 8 or 10 bit PWM. 0 = 8 bit, 1 = 10 bit.
APPCFG_PWM_FLAGS  Offset = 101 = 0x65.


PWM Channel 1 (C1) default value (10 bit value)
APPCFG_PWM_1L  Offset = 102 = 0x66.
APPCFG_PWM_1H  Offset = 103 = 0x67.


PWM Channel 2 (C2) default value (10 bit value)
APPCFG_PWM_2L  Offset = 104 = 0x68.
APPCFG_PWM_2H  Offset = 105 = 0x69.


PWM Channel 3 (G0) default value (10 bit value)
APPCFG_PWM_3L  Offset = 106 = 0x6A.
APPCFG_PWM_3H  Offset = 107 = 0x6B.


PWM Channel 4 (G3) default value (10 bit value)
APPCFG_PWM_4L  Offset = 108 = 0x6C.
APPCFG_PWM_4H  Offset = 109 = 0x6D.


PWM Channel 5 (G4) default value (10 bit value)
APPCFG_PWM_5L  Offset = 110 = 0x6E.
APPCFG_PWM_5H  Offset = 111 = 0x6F.


Web Server reserved bytes
APPCFG_WEB_RESERVED1  Offset = 112 = 0x70.
APPCFG_WEB_RESERVED2  Offset = 113 = 0x71.


Web Server Flags
  • Bit 0: Authentication required for pages that start with 'x' character.
  • Bit 1: Authentication required for ALL pages.
  • Bit 2: Authentication required for pages that execute the HTTP Get Method. When set, HTTP GET Methods are only executed for Authenticated users.
  • Bit 3: Authentication required for all Dynamic files.
  • Bit 4: Authentication required for all CGI files.
APPCFG_WEB_FLAGS  Offset = 114 = 0x72.


Web Server reserved bytes
APPCFG_WEB_RESERVED3  Offset = 115 = 0x73.


HTTP Server Port The default HTTP Server Port is 80
APPCFG_HTTPSRVR_PORTL  Offset = 116 = 0x74.
APPCFG_HTTPSRVR_PORTH  Offset = 117 = 0x75.


Serial LCD Display address
APPCFG_LCD1_ADR  Offset = 118 = 0x76.


LCD Reserved bytes
APPCFG_LCD1_RESERVED1  Offset = 119 = 0x77.
APPCFG_LCD1_RESERVED2  Offset = 120 = 0x78.
APPCFG_LCD1_RESERVED3  Offset = 121 = 0x79.
APPCFG_LCD1_RESERVED4  Offset = 122 = 0x7A.
APPCFG_LCD1_RESERVED5  Offset = 123 = 0x7B.


UDP Event Port
APPCFG_EVENT_UDPPORT0  Offset = 124 = 0x7C.
APPCFG_EVENT_UDPPORT1  Offset = 125 = 0x7D.


UDP Event Flags
APPCFG_EVENT_FLAGS  Offset = 126 = 0x7E.


Event Reserved bytes
APPCFG_EVENT_RESERVED1  Offset = 127 = 0x7F.
APPCFG_EVENT_RESERVED2  Offset = 128 = 0x80.
APPCFG_EVENT_RESERVED3  Offset = 129 = 0x81.
APPCFG_EVENT_RESERVED4  Offset = 130 = 0x82.
APPCFG_EVENT_RESERVED5  Offset = 131 = 0x83.
APPCFG_EVENT_RESERVED6  Offset = 132 = 0x84.
APPCFG_EVENT_RESERVED7  Offset = 133 = 0x85.
APPCFG_EVENT_RESERVED8  Offset = 134 = 0x86.


Expansion Board Type, is a XBRD_TYPE_XXX define
  • 0 = No Expansion board present
  • 1 = MXD2R Input Output Relay board plugged into daughter board connector
  • 2 = IOR5E Input Output Relay board plugged into daughter board connector
APPCFG_XBRD_TYPE  Offset = 135 = 0x87.


Expansion Board Analog Input 1-8 input range, 0=0V to 5V, 1=0V to 28V NOT USED IN CODE YET!!!!
APPCFG_XBRD_AI_RANGE  Offset = 136 = 0x88.
APPCFG_XBRD_RESERVED1  Offset = 137 = 0x89.
APPCFG_XBRD_RESERVED2  Offset = 138 = 0x90.
APPCFG_XBRD_RESERVED3  Offset = 139 = 0x91.
APPCFG_XBRD_RESERVED4  Offset = 140 = 0x92.
APPCFG_XBRD_RESERVED5  Offset = 141 = 0x93.
APPCFG_XBRD_RESERVED6  Offset = 142 = 0x94.
APPCFG_XBRD_RESERVED7  Offset = 143 = 0x95.
APPCFG_XBRD_RESERVED8  Offset = 144 = 0x96.

Second application config structure. Contains configuration for SPI, I2C, USART, CAN, USB serial buses. This structure lives in the internal EEPROM, starting at address 256.
!!! IMPORTANT - Only add to end the of this structure!!!
This structure can NOT get larger then 256 bytes. If it does, some code will have to be changed!

Enumerator:
BUSCFG_SER1_TXBUFSIZE  Serial Bus 1 Tx Buffer size Offset = 0 = 0x00


Serial Bus 1 Rx Buffer size
BUSCFG_SER1_RXBUFSIZE  Offset = 1 = 0x01.


Serial Bus 2 Tx Buffer size
BUSCFG_SER2_TXBUFSIZE  Offset = 2 = 0x02.


Serial Bus 2 Rx Buffer size
BUSCFG_SER2_RXBUFSIZE  Offset = 3 = 0x03.


I2C Bus 1 Tx Buffer size
BUSCFG_I2C1_TXBUFSIZE  Offset = 4 = 0x04.


I2C Bus 1 Rx Buffer size
BUSCFG_I2C1_RXBUFSIZE  Offset = 5 = 0x05.


SPI Bus 1 Tx Buffer size
BUSCFG_SPI1_TXBUFSIZE  Offset = 6 = 0x06.


SPI Bus 1 Rx Buffer size
BUSCFG_SPI1_RXBUFSIZE  Offset = 7 = 0x07.


Reserved for Serial Bus 5 to 8
BUSCFG_BUS5_TXBUFSIZE  Offset = 8 = 0x08.
BUSCFG_BUS5_RXBUFSIZE  Offset = 9 = 0x09.
BUSCFG_BUS6_TXBUFSIZE  Offset = 10 = 0x0A.
BUSCFG_BUS6_RXBUFSIZE  Offset = 11 = 0x0B.
BUSCFG_BUS7_TXBUFSIZE  Offset = 12 = 0x0C.
BUSCFG_BUS7_RXBUFSIZE  Offset = 13 = 0x0D.
BUSCFG_BUS8_TXBUFSIZE  Offset = 14 = 0x0E.
BUSCFG_BUS8_RXBUFSIZE  Offset = 15 = 0x0F.


UDP 1 Port
BUSCFG_UDP1_PORT0  Offset = 16 = 0x10.
BUSCFG_UDP1_PORT1  Offset = 17 = 0x11.


UDP Port 1 Flags
  • Bit 0: Enable UDP Port 1. When set, UDP Port 1 is enabled.
BUSCFG_UDP1_CFG  Offset = 18 = 0x12.


UDP 2 Port
BUSCFG_UDP2_PORT0  Offset = 19 = 0x13.
BUSCFG_UDP2_PORT1  Offset = 20 = 0x14.


UDP Port 2 Flags
  • Bit 0: Enable UDP Port 2. When set, UDP Port 2 is enabled.
BUSCFG_UDP2_CFG  Offset = 21 = 0x15.


BUS that UDP Port 1 is linked to, 0xff is non
BUSCFG_UDP1_LINK  Offset = 22 = 0x16.


BUS that UDP Port 2 is linked to, 0xff is non
BUSCFG_UDP2_LINK  Offset = 23 = 0x17.


Software SPI buses enabled. Bits 0 to 7 indicate which software SPI buses have been enabled.
BUSCFG_SWSPI_ENABLED  Offset = 24 = 0x18.


Software SPI 1 CLK pin. Bits 4-7 point to port (0=a, 1=b..), and bits 0-3 the bit
BUSCFG_SWSPI1_CLKPIN  Offset = 25 = 0x19.


Software SPI 1 SDI pin. Bits 4-7 point to port (0=a, 1=b..), and bits 0-3 the bit
BUSCFG_SWSPI1_SDIPIN  Offset = 26 = 0x1A.


Software SPI 1 SDO pin. Bits 4-7 point to port (0=a, 1=b..), and bits 0-3 the bit
BUSCFG_SWSPI1_SDOPIN  Offset = 27 = 0x1B.


Software SPI 1 CS pin. Bits 4-7 point to port (0=a, 1=b..), and bits 0-3 the bit
BUSCFG_SWSPI1_CSPIN  Offset = 28 = 0x1C.


Software SPI 1 config.
  • Bits 0-1 = SPI Mode
    00 = Mode 0
    01 = Mode 1
    10 = Mode 2
    11 = Mode 3
  • Bits 4-7 = Max clock speed
    0 = Maximum clock speed, no delays
    1 = About 500kbit / second maximum speed
    2 = About 250kbit / second maximum speed
    3 = About 125kbit / second maximum speed
    4 = About 62kbit / second maximum speed
    5 = About 31kbit / second maximum speed
    6 = About 15kbit / second maximum speed
    7 = About 8kbit / second maximum speed
    8 = About 4kbit / second maximum speed
    9 = About 2kbit / second maximum speed
BUSCFG_SWSPI1_CONF  Offset = 29 = 0x1D.


Function Documentation

void _appcfgPutc ( WORD  offset  ) 

Set a specified byte from the APP_CONFIG configuration structure with the data contained in the EEDATA byte.

Parameters:
offset Contains the offset in the APP_CONFIG structure of the byte to get
Returns:
Returns the requested byte

void appcfgADC ( void   ) 

Configure the ADC unit

void appcfgCpuIO ( void   ) 

Configure the CPU I/O ports

void appcfgCpuIOValues ( void   ) 

Configure the CPU I/O ports to have the configured default values

BYTE appcfgGetc ( WORD  offset  ) 

Get a specified byte from the APP_CONFIG configuration structure

Parameters:
offset Contains the offset in the APP_CONFIG structure of the byte to get. Use the APPCFG_X defines
Returns:
Returns the requested byte

void appcfgInit ( void   ) 

Pre-Condition:
fsysInit() is already called.

void appcfgPWM ( void   ) 

void appcfgSave ( void   ) 

Save Application Configuartion data to EEPROM

void appcfgUSART ( void   ) 

Configure USART with AppConfig data

void appcfgUSART2 ( void   ) 

Configure USART2 with AppConfig data

void appcfgXboard ( void   ) 

Configure the Expansion Board

void pwmEnable ( BYTE  chan,
BOOL  remember 
)

Enables/Disables given PWM channels

Parameters:
chan Bits 0-4 indicate if PWM channels 1-5 must be enabled or disabled
remember If 1, store in EEPROM and remember

BYTE pwmGetFreq ( void   ) 

Gets a constant value representing the current PWM frequency

Returns:
Frequency constant, a value from 0-3. For 8 bit mode: 1=9.766kHz, 2=39.062kHz, 3=156.25kHz For 10 bit mode: 0=2.441kHz, 1=9.766kHz, 2=39.062kHz

WORD pwmGetValue ( BYTE  ch  ) 

Get the value of the given PWM channel

Parameters:
ch PWM channnel, is a value from 1 to 5
Returns:
The given PWM channels value

void pwmSetFreq ( BYTE  freq,
BOOL  remember 
)

Sets the PWM frequency to the given value

Parameters:
freq New frequency, a value from 0-3. For 8 bit mode: 0 and 1=9.766kHz, 2=39.062kHz, 3=156.25kHz For 10 bit mode: 0=2.441kHz, 1=9.766kHz, 2 and 3=39.062kHz
remember If 1, store in EEPROM and remember

void pwmSetValue ( BYTE  ch,
WORD_VAL  val,
BOOL  remember 
)

Set the given PWM channel to the given value

Parameters:
ch PWM channnel, is a value from 1 to 5
val The value to set the channel.
  • For 8 bit mode, is a value from 0-255
  • For 10 bit mode, is a value from 0-1023
remember If 1, store in EEPROM and remember


Variable Documentation


Generated on Wed Feb 3 12:45:34 2010 for SBC65EC Web Server by  doxygen 1.5.8