Author
|
Matrix TSL
|
Version
|
1.0
|
Category
|
Storage
|
Real Time Clock (MCP7940N) component
Serial (I2C) Real Time Clock component for MCP7940N device. When used with a MIAC project this component gives access to the internal RTC (if fitted, depending upon model) and the component properties will be automatically configured.
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Downloadable macro reference
|
SetTime
|
Sets the time from a string HHMMSS
|
- STRING
|
Time
|
|
- VOID
|
Return
|
|
GetTime
|
Returns the time as a string HHMMSS
|
- STRING
|
Return
|
|
ReadRegister
|
Read and return the value of the RTC register at the given address
|
- BYTE
|
address
|
|
- BYTE
|
Return
|
|
SetDate
|
Sets the date from a string DDMMYY
|
- STRING
|
Date
|
|
- VOID
|
Return
|
|
GetDate
|
Returns the date as a string DDMMYY
|
- STRING
|
Return
|
|
WriteRegister
|
Write the given data value to the RTC register at the given address
|
- BYTE
|
address
|
|
- BYTE
|
data
|
|
- VOID
|
Return
|
|
Initialise
|
Initialises the component ready for I2C communications
|
- VOID
|
Return
|
|
ReceiveHexNumber
|
Attempts to receive a hex number as ASCII characters and convert back into a numeric value. Note this function will receive until a timeout or a none hexadecimal char is received, the none numeric char will be lost.
|
- BYTE
|
Timeout
|
Max time in ms to wait in between bytes
|
[[File:]] -
|
IgnoreData
|
0=Dont ignore any data, 1=Ignore any initial none numeric data
|
[[File:]] -
|
Prefix
|
Look for prefix before receiving, 1=0xFF, 0=FF
|
- ULONG
|
Return
|
|
SendBinary32Bit
|
Sends out a 32-bit binary value split across four bytes.
|
- ULONG
|
Value
|
|
[[File:]] -
|
MSBfirst
|
0=Least significant byte first, 1=Most significant byte first
|
- VOID
|
Return
|
|
SendBinaryFloat
|
Sends out a 32-bit binary floating point value split across four bytes.
|
[[File:]] -
|
Value
|
|
[[File:]] -
|
MSBfirst
|
0=Least significant byte first, 1=Most significant byte first
|
- VOID
|
Return
|
|
ReceiveByteArray
|
Receives an array of bytes and returns the number of bytes received.
|
- BYTE
|
Data
|
Array to store the incoming data
|
- BYTE
|
NumBytes
|
Maximum number of bytes to try and receive
|
- BYTE
|
Timeout
|
Max amount of time in ms to wait between bytes
|
- BYTE
|
Return
|
|
ReceiveString
|
Attempts to receive a string of bytes from the UART interface.
|
- BYTE
|
Timeout
|
Time to wait in milliseconds for valid data before returning, 0=Dont wait, 255=Wait forever.
|
- UINT
|
NumBytes
|
The number of bytes to try and receive, ideally your string variable should have at least 1 more byte to store the null termination byte
|
- STRING
|
Return
|
|
Initialise
|
Sets up the RS232 peripheral, must be called at the start of your program or at least before you start calling any other RS232 macros.
|
- VOID
|
Return
|
|
ReceiveChar
|
Attempts to receive a single packet from the UART interface.
|
- BYTE
|
Timeout
|
Time to wait in milliseconds for valid data before returning, 0=Dont wait, 255=Wait forever.
|
[[File:]] -
|
Return
|
|
ReceiveString
|
Puts the RF module in data mode and attempts to receive a string of bytes from the RF connection.
|
- BYTE
|
Length
|
Specifies the maximum number of bytes to try and receive
|
- BYTE
|
Timeout
|
Specifies how many milliseconds to wait for valid data before returning.
|
- STRING
|
Return
|
|
Initialise
|
Starts up and configures the RF module ready for use. The macro will return a value greater then 0 if the module has been started correctly, otherwise the macro will return a 0.
|
- BYTE
|
Return
|
|
Initialise
|
Sets up the 1-Wire output pin ready for communications.
|
- VOID
|
Return
|
|
Initialise
|
Starts up the UART to allow communications and initialises the states of the various Modbus Coils, Inputs and Registers to 0.
|
- VOID
|
Return
|
|
Initialise
|
Initialises the MIDI component and sets up the UART.
|
- VOID
|
Return
|
|
CommsBaud
|
Sets the Baud rate of the alt communications channel
|
- BYTE
|
Baud
|
Range: 0-7 : 0=1200 / 7=115200
|
- VOID
|
Return
|
|
LCDOptions
|
Controls some of the LCD options
|
- BYTE
|
Foreground
|
Range: 0-1
|
- BYTE
|
Background
|
Range: 0-1
|
- BYTE
|
Transparent
|
Range: 0-1
|
- VOID
|
Return
|
|
LCDVerbose
|
Controls the Verbose mode. When enabled the LCD automatically displays an account of the incoming API commands and parameters. When switched off the LCD is free for the user to control as required.
|
- BYTE
|
Mode
|
Range: 0-1 : 0=Off or User Mode / 1=API Verbose Mode
|
- VOID
|
Return
|
|
ReadDigitalInput
|
Reads a single digital input.
|
- BYTE
|
Channel
|
|
- BYTE
|
Return
|
|
PWMConfig
|
Sets the PWM configuration. Channel = 0 - 1 : 0 = EN_AB, A, B / 1 = EN_CD, C, D Period = 0 - 65535 Scaler = 0 - 3 : 0=1:1 1=1:8 2=1:64 3=1:256
|
- BYTE
|
Channel
|
Range 0-1
|
- UINT
|
Period
|
Range: 0-65535
|
- BYTE
|
Scaler
|
Range: 0-3
|
- VOID
|
Return
|
|
PWMEnable
|
Allows pulse width modulated transistor outputs to be switched on or off. Bit 0 = Enable AB Bit 1 = A / Bit 2 = B Bit 3 = C / Bit 4 = D Bit 5 = Enable CD
|
- BYTE
|
EnableMask
|
Range 0-63 or 0b00000 to 0b111111
|
- VOID
|
Return
|
|
PWMDuty
|
Sets a single PWM channel duty. Channel = 0 - 5 : 0=EN_AB, 1=A, 2=B, 3=C, 4=D, 5=EN_CD Duty = 0 - 65535
|
- BYTE
|
Channel
|
Range 0-5
|
- UINT
|
Duty
|
|
- VOID
|
Return
|
|
LCDCursor
|
Sets the cursor position for the MIAC display
|
- BYTE
|
X
|
Range: 0-21
|
- BYTE
|
Y
|
Range: 0-4
|
- VOID
|
Return
|
|
WriteTran
|
Allows a single transistor output to be switched on or off.
|
- BYTE
|
Channel
|
Range 1-4
|
- BYTE
|
Value
|
0 = Off, 1 = On
|
- VOID
|
Return
|
|
Initialise
|
|
- VOID
|
Return
|
|
LCDClear
|
Clears the MIAC display
|
- VOID
|
Return
|
Property reference
|
Properties
|
|
Console Data
|
Selects if the console data is automatically generated or not
|
|
Scope Traces
|
Selects if the component pin connections are automatically generated on the data recorder window or not. Yes: Automatically add the component pins to a group on the data recorder which will reflect the sim data during simultion. No: Do not show the pin signals on the data recorder window.
|
|
API
|
|
|
Connections
|
|
Channel
|
Channel selection
|
|
SDA
|
Pin used for SDA (data signal)
|
|
SDA Remap Pin
|
|
|
SCL
|
Pin used for SCL (clock signal)
|
|
SCL Remap Pin
|
|
|
Stop Delay
|
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications.
|
|
Baud Select
|
Baud rate option selector
|
|
Baud Rate
|
Baud rate to be used
|
|
Simulations
|
|
Simulate Comms
|
|