Component: IntOsc Helper (Matrix Tools)

From Flowcode Help
Revision as of 10:36, 17 November 2021 by Wiki bot (talk | contribs)
Jump to navigationJump to search
Author MatrixTSL
Version 1.0
Category Matrix Tools


IntOsc Helper component

A component to help configure the speed of the internal oscillator. Currently only supports 8-bit PIC devices.

Detailed description

No detailed description exists yet for this component

Examples

The INT OSC helper component is designed to help you configure the rate of the internal oscillator on-board your microcontroller.

It can be found under the Runtime -> Matrix Tools component category.


The oscillator speed drop down menu shows you what speeds are available on your device. Use this to select a speed.

INTOSC1.jpg


Once you have chosen your required internal oscillator speed copy the code from the Code property.

INTOSC2.jpg


Paste the configuration code into a C icon at the top of your main macro.

INTOSC3.jpg


Next change the clock speed in the project options to match your oscillator speed. This will ensure that delays and baud rates are calculated correctly.

INTOSC4.jpg


Finally you need to enable the internal oscillator in the configuration settings.

INTOSC6.jpg


If everything is correct then the Info field should confirm that the project options clock speed matches the current speed selection.

INTOSC5.jpg

Downloadable macro reference

Fc9-comp-macro.png Initialise
Called to set the internal oscillator speed to the specified value. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SampleMag
Samples the magnetometer 0 = no new data, 1 = new data available 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png CardCreate
Attempts to create a file on the SD card 255=Error, 1=File Already Exists, 0=Create OK 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png LCDPrintNumber
Prints a 16-bit signed number to the LCD 
Fc9-u8-icon.png - BYTE X
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y
LCD Y coordinate 0-31 
[[File:]] - Number
Range -32768 to 32767 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png LEDOff
Clears a single LED 0-7 
Fc9-u8-icon.png - BYTE index
Range: 0-7 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png LEDWrite
Sets the value of the LEDs as an 8-bit output 
Fc9-u8-icon.png - BYTE Value
LED value 0=All Off, 255 = All On 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ReadAxis
Reads a single X/Y/Z axis from the accelerometer sensor.  
Fc9-u8-icon.png - BYTE index
0=X, 1=Y, 2=Z 
[[File:]] - Return


Fc9-comp-macro.png ServoSetAutoMoveSpeed
Changes the speed of the auto movements Default - 1 
Fc9-u8-icon.png - BYTE Speed
Range 1-50 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png CardPlayback
Plays back a .Wav file audio stream from the card 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png ReadMic
Reads the microphone sensor 0 - 4095 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png ReadSwitch
Read the switch value 
Fc9-u8-icon.png - BYTE index
0 (left) or 1 (right) 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png SampleAccel
Samples the accelerometer 0 = no new data, 1 = new data available 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png Left
Rotates the robot left - waits for the angle to be traversed before returning 
Fc9-u16-icon.png - UINT Angle
Angle to turn in degrees 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ReadIR
Reads an IR sensor 0=Left, 1=FrontLeft, 2=Front, 3=FrontRight, 4=Right, 5=RearRight, 6=Rear, 7=RearLeft 
Fc9-u8-icon.png - BYTE index
0=Left, 1=FrontLeft, 2=Front, 3=FrontRight, 4=Right, 5=RearRight, 6=Rear, 7=RearLeft 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png LCDDrawPixel
Allows a single pixel on the LCD to be set or cleared 
Fc9-u8-icon.png - BYTE X
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y
Y Pixel 0-31 
Fc9-u8-icon.png - BYTE State
0=White (Off), 1=Black (On) 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ServoSetPosition
Allows one of the servo positions to be assigned 
Fc9-u8-icon.png - BYTE Channel
Range 0-3 
Fc9-u8-icon.png - BYTE Position
Range 0-255 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png CardBitmap
Displays a monochrome bitmap read from the card on the LCD 
Fc9-u8-icon.png - BYTE X
Range 0-127 
Fc9-u8-icon.png - BYTE Y
Range 0-31 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png CardRecordMic
Records an audio stream on the card from the microphone 
Fc9-u8-icon.png - BYTE BitDepth
0=8-bit, 1=16-bit 
Fc9-u8-icon.png - BYTE SampleRate
Sample Rate 0=8KHz, 1=16KHz 
Fc9-u16-icon.png - UINT RecordTime
Time to record for in seconds, Range 0-65535 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png CardOpen
Attempts to open an existing file on the SD card 255=Error, 1=File not found, 0=Open OK 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png Forwards
Drives the robot forwards - waits for the distance to be traversed before returning 
Fc9-u16-icon.png - UINT Distance
Distance in mm 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ReadBearing
Reads the compass bearing based on the degrees clockwise from magnetic north. 
[[File:]] - Return


Fc9-comp-macro.png GetConsoleHandle
Gets the handle to the console allowing data displaying on the panel etc. 
[[File:]] - Return


Fc9-comp-macro.png LCDDrawLine
Allows a single pixel width line to be drawn on the LCD 
Fc9-u8-icon.png - BYTE X1
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y1
Y Pixel 0-31 
Fc9-u8-icon.png - BYTE X2
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y2
Y Pixel 0-31 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ServoAutoMoveToPosition
Allows one of the servo positions to move gradually to a new position 
Fc9-u8-icon.png - BYTE Channel
Range 0-3 
Fc9-u8-icon.png - BYTE Position
Range 0-255 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ReadAllValue
Reads a single value stored from the read all command Index dictates which sensor value to read 
Fc9-u8-icon.png - BYTE Index
0=SW, 1-8=IR, 9-10=Line, 11=Light, 12=Mic, 13-15=Accel 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png LCDBacklight
Allows the LCD backlight brighntess to be adjusted 
Fc9-u8-icon.png - BYTE Intensity
Range 0-100, 0=Off, 1=Min Brightness, 100=Max Brightness 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png LCDDrawRect
Allows a rectangle to be drawn on the LCD 
Fc9-u8-icon.png - BYTE X1
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y1
Y Pixel 0-31 
Fc9-u8-icon.png - BYTE X2
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y2
Y Pixel 0-31 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ReadLine
Reads one of the IR line sensors 0-1 0=Left, 1=Right 
Fc9-u8-icon.png - BYTE index
0=Left, 1=Right 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png ServoDisable
Allows one of the servo outputs 0-3 to be disabled 
Fc9-u8-icon.png - BYTE Channel
Range 0-3 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ServoEnable
Allows one of the servo outputs 0-3 to be enabled 
Fc9-u8-icon.png - BYTE Channel
Range 0-3 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png CardReadByte
Reads a byte from the currently open file. Starts at the beginning of the file and auto increments to the end 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png CardErase
Attempts to delete an existing file on the SD card 255=Error, 1=File not found, 0=Delete OK 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png CardWriteByte
Appends a byte to the end of the currently open file  
Fc9-u8-icon.png - BYTE Data
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png EncoderRead
Reads one of the motor encoder counters. Approx 0.328296mm of travel per encoder unit. 
Fc9-u8-icon.png - BYTE index
0=Left, 1=Right 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png SetMotors
Sets the motor speeds without feedback Range -100 to 100 
[[File:]] - Left
Range -100 to 100 
[[File:]] - Right
Range -100 to 100 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Backwards
Drives the robot backwards - waits for the distance to be traversed before returning 
Fc9-u16-icon.png - UINT Distance
Distance in mm 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png EncoderReset
Resets the motor encoder counters 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png LCDVerbose
Allows the LCD to automatically report the API commands as they get processed. Default - verbose on 
Fc9-u8-icon.png - BYTE State
0=Off 1=On 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetProp
Allows the COM port property to be set from a parent component. 
Fc9-string-icon.png - STRING PropName
 
Fc9-u32-icon.png - ULONG PropVal
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png CardInit
Attempts to startup the SD card 255=No Card, 254=Init Fail, 0=Init OK 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png GetProp
Allows the property filter for the COM port list to be copied to a parent component. 
Fc9-string-icon.png - STRING PropName
 
Fc9-string-icon.png - STRING Return


Fc9-comp-macro.png LCDClear
Clears the LCD 
Fc9-void-icon.png - VOID Return



Property reference

Fc9-prop-icon.png Properties
Fc9-type-16-icon.png Oscillator Speed
Shows what internal oscillator speeds are available on the device and allows the user to select an option. 
Fc9-type-11-icon.png Info
General info to the user, checks to see if the selected oscillator speed matches the project oscillator speed. 
Fc9-type-11-icon.png Code
Code to configure the internal oscillator module. This code must be added to a C icon which should be placed at the top of main. 
Fc9-conn-icon.png Connections
Fc9-conn-icon.png Simulations