oSerialH Object

Main Index
Object List
Back to top of pageDescription:
 Provides a high-speed asynchronous serial I/O port using hardware specific I/O lines.
 The following table lists the size and availability of the oSerialH Object.
 ObjectSizeDescriptionA1A2B1B2C1
oSerialH4 BytesProvides a high-speed asynchronous serial I/O port using hardware specific I/O lines.xxxxx
Back to top of pageOperation:
 When a value is written to the Value property, the value is sent serially out I/O Line 22. When a value is received serially from I/O line 23 it is stored in the Value property and the Received property is set to 1 (cvTrue). 

The Baud property specifies at which baud rate to send and receive data .  It can specify a baud rate of 1200, 2400, 4800, 9600, 19200, 31500, 38400, or 50000 Baud.

The value of the Received property can be link to an oDio1 Object that has its Direction property set to cvOutput thereby providing flow control for incoming serial data.  The device sending the serial data will be expected to stop sending the serial data while the output of the oDio1 Object is at +5 Volts.  If the device sending the serial data sends and data after the Received property is set then the 1-byte buffer will be overrun and data will be lost.

When created, the oSerialH Object also creates an instance of the oUSART object which it uses to do the actual serial transmissions and receptions.  Most properties of the oUSART instance can be adjusted and will affect the oSerialH Object's operation such as USART.Mode which is used to specify synchronous or asynchronous operation.  See the oUSART Help for more detail on how serial data transmissions work.

Back to top of pageProperties:
 

The following table lists the properties of the oSerialH Object:

Property

Description

Value
The value of the received data. If written to, the data is transmitted.
Object Class: oByte Value Range: 0 - 255
Data Type: Numeric Default Value: 0
Received
A value that indicates if data has been received. Must be cleared by user.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
The following table lists the values of the Received property:
ReceivedConstantDescription
0cvFalseNo new data has been received.
1cvTrueNew data has been received.
Baud
A value that specifies the baud rate which controls the speed of the serial data stream.
Object Class: oProperty Value Range: 0 - 15
Data Type: Numeric Default Value: 0
When the Baud rate property is set, the Operate is checked.  If the Operate property is 1, then the Baud rate is set into the serial communications module's baud rate register.  If the Operate property is 0, then the serial communications module's baud rate register remains unchanged until the Operate property is set to 1.
The following table lists the values of the Baud property:
BaudConstantDescription
0cvMidiSerial data communicates at 31,250 Baud. (Midi)
1cv1200Serial data communicates at 1200 Baud.
2cv2400Serial data communicates at 2400 Baud.
3cv9600Serial data communicates at 9600 Baud.
4cv4800Serial data communicates at 19,200 Baud. (Available as of firmware version B.1.0)
5cv19200Serial data communicates at 4800 Baud. (Available as of firmware version B.1.0)
6cv50000Serial data communicates at 50,000 Baud. (Available as of firmware version B.1.0)
7cv38400Serial data communicates at 38,400 Baud. (Available as of firmware version B.2.0)
Operate
A value that selects whether or not serial data will be receive or sent.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOffThe serial port is not operating.
1cvOnThe serial port is operating at the specified baud rate.
USART
The PIC Hardware object used to transmit and receive the serial data.
Object Class: oUSART Value Range: 0 - 255
Data Type: Numeric Default Value: 0
Address
Returns a pointer to the address of the oCounter Object instance.
Object Class: oAddress Value Range: 0 - 127
Data Type:Pointer (Read Only) Default Value: Address of Object

Back to top of pageExamples:
 In the following examples, the oSerial Object is used
'This program reads an oA2D Object
'and sends the value to a PC 
'connected via a serial port.
'Note: No flow control is used.

Dim A As New oSerial
Dim B As New oA2D

Sub Main()
  B.IOLine = 1
  B.Operate = cvTrue
  A.Baud = cv9600
  A.Operate = cvTrue
  Do  
    A.Value = Str$(B)
    A.Value = 13
    A.Value = 10
  Loop
End Sub
'This program takes any serial
'data that a oSerial Object 
'has received and sends it
'back out the oSerial Object.
'Note: No flow control is used.

Dim A As New oSerial

Sub Main()
  A.Baud = cv9600
  A.Operate = cvTrue
  Do  
    If A.Received = cvTrue then
      A.Value = A.Value
    End If
  Loop
End Sub
Back to top of page Related Items:
 The following table lists objects that use the oSerialH Object.
 ObjectDescriptionA1A2B1B2C1
oSerialPortProvides a high-speed asynchronous serial I/O port with a buffer.xxxx
 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oSerialLProvides a low-speed asynchronous serial Input or Output on any I/O line.xxx
oSerialPortProvides a high-speed asynchronous serial I/O port with a buffer.xxxx
oSPILProvides a low-speed Serial Peripheral Interface on any I/O line.xx
Back to top of page Version History and Bug List:
 Firmware Ver A.1.0: Introduced.
Firmware Ver B.1.0: 19200, 4800, and 50000 baud added.
Firmware Ver B.2.0: 38400 baud added.

Bugs: No known bugs.


ooPIC Compiler Ver 6.0 (c) Copyright 1997 - 2007 Savage Innovations, LLC.