Posted by Rick Berube.
Engineer on team #121, Rhode Warriors, from Middletown H.S…
Posted on 5/25/99 10:38 PM MST
In Reply to: Wait a minute… posted by Joe Johnson on 5/25/99 5:12 AM MST:
Based on the time of your posting, I’d say this either keep you up all night or woke you from a sound sleep!
I don’t recall mentioning that you’d have to give up interrupts? I wouldn’t suggest a solution without interrupts (http://www.chiefdelphi.com/wwwboard/messages/2207.html After all we’re after a better world through technology here, right. Last time I looked even RISC controllers had interrupts because no one’s discovered anything better.
To put your mind at ease, here are some excerpts pertaining to the BasicX API from the NetMedia documents. You really should download and review them for yourself. It’s quite an impressive chip. I’m not saying there won’t be issues/limitations, however it should be considered before being dismissed.
Syntax
Call WaitForInterrupt(InterruptType)
Arguments
Item Type Direction Description
InterruptType Byte Input Interrupt type. See below for allowable values.
Allowable values for InterruptType:
bxComparatorToggle = 0 Comparator toggle state
bxComparatorFallingEdge = 2 Falling edge of comparator
bxComparatorRisingEdge = 3 Rising edge of comparator
bxPinLow = 16 Low level on pin 13
bxPinFallingEdge = 24 Falling edge on pin 13
bxPinRisingEdge = 28 Rising edge on pin 13
Description
WaitForInterrupt allows a task to respond immediately to a critical event from the outside world. This procedure gives you access to hardware interrupts built into the BasicX chip.
WaitForInterrupt blocks the calling task until an external event happens. When the event occurs, the task is scheduled to be run immediately. The task has priority, even if another task is running and locked (see procedure LockTask).
Warning
If no external event is generated, the calling task could wait indefinitely.
Example
’ Wait for rising edge on comparator.
Call WaitForInterrupt( bxComparatorRisingEdge )
System library
The BasicX operating system provides a library of system calls in the following categories:
Math functions
Abs Absolute value
ACos Arc cosine
ASin Arc sine
Atn Arc tangent
Cos Cosine
Exp Raises e to a specified power
Exp10 Raises 10 to a specified power
Log Natural log
Log10 Log base 10
Pow Raises an operand to a specified power
Sin Sine
Sqr Square root
Tan Tangent
String functions
Asc Returns the ASCII code of a character
Chr Converts a numeric value to a character
Len Returns the length of a string
Mid Copies a substring
Memory-related functions
BlockMove Copies a block of data from one RAM location to another
GetEEPROM Reads data from EEPROM
GetXIO Reads data from extended I/O
GetXRAM Reads data from XRAM
MemAddress Returns the address of a variable or array
MemAddressU Returns the address of a variable or array
PersistentPeek Reads a byte from EEPROM
PersistentPoke Writes a byte to EEPROM
PutEEPROM Writes data to EEPROM
PutXIO Writes data to extended I/O
PutXRAM Writes data to XRAM
RAMpeek Reads a byte from RAM
RAMpoke Writes a byte to RAM
SerialNumber Returns the unique serial number of a BasicX chip
Queues
GetQueue Reads data from a queue
OpenQueue Defines an array as a queue
PeekQueue Looks at queue data without actually removing any data
PutQueue Writes data to a queue
PutQueueStr Writes a string to a queue
StatusQueue Determines if a queue has data available for reading
Tasking
CallTask Starts a task
CPUsleep Puts the processor in various low-power modes
FirstTime Determines whether the program has ever been run since download
LockTask Locks the task and discourages other tasks from running
OpenWatchdog Starts the watchdog timer
ResetProcessor Resets and reboots the processor
Semaphore Coordinates the sharing of data between tasks
Sleep Pauses task and allows other tasks to run
TaskIsLocked Determine whether a task is locked
UnlockTask Unlocks a task
WaitForInterrupt Allows a task to respond to a hardware interrupt
Watchdog Resets the watchdog timer
Type conversions
CByte Convert to Byte
CInt Convert to Integer
CLng Convert to Long
CSng Convert to floating point (single)
CuInt Convert to UnsignedInteger
CuLng Convert to UnsignedLong
Fix Truncates a floating point value
FixB Truncates a floating point value, converts to Byte
FixI Truncates a floating point value, converts to Integer
FixL Truncates a floating point value, converts to Long
FixUI Truncates a floating point value, converts to UnsignedInteger
FixUL Truncates a floating point value, converts to UnsignedLong
Real time clock
GetDate Returns the date
GetDayOfWeek Returns the day of week
GetTime Returns the time of day
GetTimestamp Returns the date and time of day
PutDate Sets the date
PutTime Sets the time of day
PutTimestamp Sets the date, day of week and time of day
Timer Returns floating point seconds since midnight
Pin I/O
DACpin Generates a pseudo-analog voltage at an output pin
GetPin Returns the logic level of an input pin
InputCapture Records a pulse train on the input capture pin
OutputCapture Sends a pulse train to the output capture pin
PulseIn Measures pulse width on an input pin
PulseOut Sends a pulse to an output pin
PutPin Configures a pin to several input or output states
RCtime Measures the time delay until a pin transition occurs
Communications
GetNetwork Reads data from a remote RAM location
GetNetworkP Reads data from a remote EEPROM location
OpenCom Opens an RS-232 serial port
OpenNetwork Opens the network
OpenSPI Opens SPI communications
PutNetwork Sends data to a remote RAM location
PutNetworkP Sends data to a remote EEPROM location
PutNetworkPacket Sends a special packet over the network
PutNetworkQueue Sends data to a remote queue
SPIcmd SPI communications