Rabbit BL4S200 User Manual

Manual is about: C-Programmable Single-Board Computer with Networking

Summary of BL4S200

  • Page 1

    Bl4s200 c-programmable single-board computer with networking user’s manual 019–0171_e.

  • Page 2

    Digi international inc. Www.Rabbit.Com bl4s200 user’s manual part number 019-0171_d • printed in u.S.A. ©2008–2010 digi international inc. • all rights reserved. Digi international reserves the right to make changes and improvements to its products without providing notice. Trademarks rabbit, rabbit...

  • Page 3: Able

    Bl4s200 user’s manual 3 t able of c ontents chapter 1. Introduction 6 1.1 bl4s200 description ...........................................................................................................................6 1.2 bl4s200 features................................................................

  • Page 4

    Bl4s200 user’s manual 4 3.8 other hardware...................................................................................................................................47 3.8.1 clock doubler ...........................................................................................................

  • Page 5

    Bl4s200 user’s manual 5 chapter 7. Using the zigbee features 160 7.1 introduction to the zigbee protocol .................................................................................................160 7.2 zigbee sample programs ......................................................................

  • Page 6: 1.  I

    Bl4s200 user’s manual 6 1. I ntroduction the bl4s200 series of high-performance, c-programmable single- board computers offers built-in digital and analog i/o combined with ethernet, wi-fi, or zigbee network connectivity in a com- pact form factor. The bl4s200 single-board computers are ideal for bo...

  • Page 7

    Bl4s200 user’s manual 7 • ethernet, wi-fi, or zigbee network connectivity. • up to 5 serial ports: up to three serial ports (one 5-wire rs-232 or two 3-wire rs-232, one rs-485). Two rabbitnet™ expansion ports multiplexed from one serial port. One serial port dedicated to programming/debugging. • bat...

  • Page 8

    Bl4s200 user’s manual 8 1.3 development and evaluation tools 1.3.1 tool kit a tool kit contains the hardware essentials you will need to use your own bl4s200 single- board computer. These items are supplied in the tool kit. • getting started instructions. • dynamic c cd-rom, with complete product do...

  • Page 9

    Bl4s200 user’s manual 9 1.3.2 software the bl4s200 is programmed using version 10.42 or later of rabbit’s dynamic c. A com- patible version is included on the tool kit cd-rom. This version of dynamic c includes the popular µc/os-ii real-time operating system, point-to-point protocol (ppp), fat file ...

  • Page 10

    Bl4s200 user’s manual 10 1.4 rabbitnet peripheral cards rabbitnet™ is an spi serial protocol that uses a robust rs-422 differential signalling interface (twisted-pair differential signaling) to run at a fast 1 megabit per second serial rate. Bl4s200 single-board computers have two rabbitnet ports, e...

  • Page 11

    Bl4s200 user’s manual 11 1.5 ce compliance equipment is generally divided into two classes. These limits apply over the range of 30–230 mhz. The limits are 7 db higher for frequen- cies above 230 mhz. Although the test range goes to 1 ghz, the emissions from rabbit- based systems at frequencies abov...

  • Page 12

    Bl4s200 user’s manual 12 1.5.1 design guidelines note the following requirements for incorporating the bl4s200 series of single-board computers into your application to comply with ce requirements. General • the power supply provided with the tool kit is for development purposes only. It is the cust...

  • Page 13

    Bl4s200 user’s manual 13 1.6 wi-fi certifications (bl5s220 model only) the systems integrator and the end-user are ultimately responsible for the channel range and power limits complying with the regulatory requirements of the country where the end device will be used. Dynamic c function calls and s...

  • Page 14

    Bl4s200 user’s manual 14 labeling requirements (fcc 15.19) if the fcc identification number is not visible when the module is installed inside another device, then the outside of the device into which the module is installed must also display a label referring to the enclosed module or the device mu...

  • Page 15

    Bl4s200 user’s manual 15 1.6.3 europe the marking shall include as a minimum: • the name of the manufacturer or his trademark; • the type designation; • equipment classification, (see below). Note: manufacturers are recommended to declare the classification of their devices in accordance with table ...

  • Page 16: 2.   G

    Bl4s200 user’s manual 16 2. G etting s tarted chapter 2 explains how to connect the programming cable and power supply to the bl4s200. 2.1 preparing the bl4s200 for development position the bl4s200 as shown below in figure 2. Attach the four stand-offs supplied with the tool kit in the holes at the ...

  • Page 17

    Bl4s200 user’s manual 17 2.2 bl4s200 connections 1. Connect the programming cable to download programs from your pc and to program and debug the bl4s200. Connect the 10-pin prog connector of the programming cable to header j1 on the bl4s200’s rabbitcore module (the programming header is labeled j2 o...

  • Page 18

    Bl4s200 user’s manual 18 2. Connect the power supply to header j5 on the bl4s200 as shown in figure 4. Be sure to match the latch mechanism with the top of the connector to header j5 on the bl4s200 as shown. The micro-fit ® connector will only fit one way. Figure 4. Power supply connections 3. Apply...

  • Page 19

    Bl4s200 user’s manual 19 2.3 installing dynamic c if you have not yet installed dynamic c version 10.42 (or a later version), do so now by inserting the dynamic c cd from the bl4s200 tool kit in your pc’s cd-rom drive. If autorun is enabled, the cd installation will begin automatically. If autorun i...

  • Page 20

    Bl4s200 user’s manual 20 2.4 starting dynamic c once the bl4s200 is connected to your pc and to a power source, start dynamic c by double-clicking on the dynamic c icon on your desktop or in your start menu. Select store program in flash on the “compiler” tab in the dynamic c options > project optio...

  • Page 21

    Bl4s200 user’s manual 21 2.6 run a wi-fi sample program (bl5s220 only) find the wifiscan.C sample program in the dynamic c samples\wifi folder, open it with the file menu, then compile and run the sample program by pressing f9 . The dynamic c stdio window will display starting scan.... , and will di...

  • Page 22

    Bl4s200 user’s manual 22 2.7 run a zigbee sample program (bl4s230 only) this section explains how to run a sample program in which the bl4s230 is used in its default setup as a router and the digi ® xbee usb is used as the zigbee coordinator. 1. Connect the digi ® xbee usb acting as a zigbee coordin...

  • Page 23

    Bl4s200 user’s manual 23 2.8 where do i go from here? Note: if you purchased your bl4s200 through a distributor or rabbit partner, contact the distributor or partner first for technical support. If there are any problems at this point: • use the dynamic c help menu to get further assistance with dyn...

  • Page 24: 3.  S

    Bl4s200 user’s manual 24 3. S ubsystems chapter 3 describes the principal subsystems for the bl4s200. • digital i/o • serial communication • a/d converter inputs • d/a converter outputs • analog reference voltages circuit • memory figure 5 shows these rabbit-based subsystems designed into the bl4s20...

  • Page 25

    Bl4s200 user’s manual 25 3.1 bl4s200 pinouts the bl4s200 pinouts are shown in figure 6. Figure 6. Bl4s200 pinouts j9 j10 j11 j12 j8 j7 j6 j4 j3 j2 j1 j11 battery 1 4 5 2 6 3 +5 v gnd gnd +5 v +ra w +ra w rabbitnet 2 rabbitnet 1 4 11 12 5 13 6 agnd aout0 ain0 ain2 agnd ain5 ain7 aout1 agnd ain1 ain3 ...

  • Page 26

    Bl4s200 user’s manual 26 3.1.1 connectors standard bl4s200 models are equipped with seven polarized 2 × 5 micro-fit ® connectors (j1–j4 and j9–j11), one polarized 2 × 7 micro-fit ® connector (j12), and one polarized 2 × 3 connector at j7 to supply power (dcin and +5 v) to up to two rabbitnet periph-...

  • Page 27

    Bl4s200 user’s manual 27 3.2 digital i/o 3.2.1 configurable i/o 3.2.1.1 digital inputs the bl4s200 has 32 configurable i/o, dio0–dio31, each of which may be configured individually in software as either digital inputs or as sinking digital outputs. By default, a configurable i/o channel is a digital...

  • Page 28

    Bl4s200 user’s manual 28 table 3 lists the banks of configurable i/o and summarizes the jumper settings. Table 3. Banks of bl4s200 digital inputs digital inputs configuration header pins jumpered pulled up/pulled down dio0–dio7 jp9 1–2 inputs pulled up to +kx dio8–dio15 jp8 3–4 inputs pulled up to +...

  • Page 29

    Bl4s200 user’s manual 29 3.2.1.2 sinking digital outputs when you configure a configurable i/o pin as a sinking output, be sure to con- nect an external voltage source up to 36 v dc across the corresponding +kx and gnd on connector j1, j2, j9, or j10, and set the pullup jumper on the corresponding j...

  • Page 30

    Bl4s200 user’s manual 30 3.2.1.3 configurable i/o special uses individual configurable i/o pins may be used for interrupts, input capture, as quadrature decoders, or as pwm outputs. The use of these channels for pwm, interrupts, input cap- ture, and as quadrature decoders is described in the rabbit ...

  • Page 31

    Bl4s200 user’s manual 31 keep the following guidelines in mind when selecting special uses for the remaining con- figurable i/o pins. • interrupts, event counters, and input capture are available on any configurable i/o pin. • each quadrature decoder channel requires at least two configurable i/o pi...

  • Page 32

    Bl4s200 user’s manual 32 interrupt, counter, and event capture setup external interrupts on the bl4s200 configurable i/o pins are configured using the setextinterrupt() function call. The interrupt can be set up to occur on a rising edge, a falling edge, or either edge. The counter readings can be o...

  • Page 33

    Bl4s200 user’s manual 33 pwm/ppm outputs setup pwm and ppm outputs on the bl4s200 configurable i/o are configured using the set- pwm() and setppm() function calls. Pwm and ppm outputs on the bl4s200 high-cur- rent outputs are configured using the setpwm_h() and setppm_h() function calls. A pwm outpu...

  • Page 34

    Bl4s200 user’s manual 34 3.2.2 high-current digital outputs the bl4s200 has eight high-current digital outputs, hout0–hout7, which can each sink or source up to 2 a. Figure 10 shows a wiring diagram for using the digital outputs in either a sinking or a sourcing configuration. Figure 10. Bl4s200 hig...

  • Page 35

    Bl4s200 user’s manual 35 high-current outputs have their own function calls for control ( digout_h() and digouttristate_h() ) and to set up the pwm and ppm outputs. All function calls that work with high-current outputs end with _h — do not confuse these function calls with their configurable i/o co...

  • Page 36

    Bl4s200 user’s manual 36 3.3 serial communication the bl4s200 has up to three serial communication ports, one rs-485 channel, and either one rs-232 serial channel (with rts/cts) or two rs-232 (3-wire) channels. Table 7 summarizes the serial ports. Two rabbitnet™ expansion ports are multiplexed from ...

  • Page 37

    Bl4s200 user’s manual 37 the bl4s200 can be used in an rs-485 multidrop network. Connect the 485+ to 485+ and 485– to 485– using single twisted-pair wires (nonstranded, tinned) as shown in figure 12. Note that a common ground is recommended. Figure 12. Bl4s200 multidrop network the bl4s200 comes wit...

  • Page 38

    Bl4s200 user’s manual 38 for best performance, the bias and termination resistors in a multidrop network should only be enabled on both end nodes of the network. Disable the termination and bias resis- tors on any intervening bl4s200 units in the network by removing both jumpers from header jp6. Tip...

  • Page 39

    Bl4s200 user’s manual 39 3.3.4 ethernet port figure 14 shows the pinout for the ethernet port (j2 on the bl4s200 modules that support ethernet networking). Note that there are two standards for numbering the pins on this con- nector—the convention used here, and numbering in reverse to that shown. R...

  • Page 40

    Bl4s200 user’s manual 40 3.4 a/d converter inputs the single a/d converter chip used in the bl4s200 has a resolution of 12 bits (11 bits for the value and one bit for the polarity). The a/d converter chip has a programmable ampli- fier. Each external input has circuitry that provides scaling and fil...

  • Page 41

    Bl4s200 user’s manual 41 in the differential mode, each individual channel is limited to half the total voltage—for example, the range for a gain code of 1 is ±20 v, but each channel is limited to ±10 v. The a/d converter inputs are factory-calibrated, and the calibration constants are stored in the...

  • Page 42

    Bl4s200 user’s manual 42 3.4.1 a/d converter calibration to get the best results form the a/d converter, it is necessary to calibrate each mode (single-ended, differential, and current) for each of its gains. It is imperative that you cali- brate each of the a/d converter inputs in the same manner a...

  • Page 43

    Bl4s200 user’s manual 43 3.5 d/a converter outputs the two d/a converter outputs are buffered and scaled to provide an output from 0 v to +10 v (12-bit resolution) or ±10 v (11-bit resolution, one bit used for polarity). The selec- tion is made via jumpers on header jp3 for aout0 and via jp6 for aou...

  • Page 44

    Bl4s200 user’s manual 44 to stay within the maximum power dissipation of the d/a converter circuit, the maximum d/a converter output current is 10 ma per channel for the voltage outputs. If you are using the current outputs, keep the resistance driven by a current output channel above 1 k  to stay ...

  • Page 45

    Bl4s200 user’s manual 45 3.6 analog reference voltages circuit figure 18 shows the analog voltage reference circuit. Figure 18. Analog reference voltages the a/d converter chip supplies the 2.5 v reference voltage, which is then amplified and buffered to provide the 3.00 v, 1.95 v, and 1.116 v refer...

  • Page 46

    Bl4s200 user’s manual 46 3.7 usb programming cable the usb programming cable is used to connect the serial programming port of the bl4s200 to a pc usb port. The programming cable converts the voltage levels used by the pc usb port to the cmos voltage levels used by the rabbit microprocessor. When th...

  • Page 47

    Bl4s200 user’s manual 47 3.8 other hardware 3.8.1 clock doubler the bl4s200 ethernet models and the wi-fi model (bl4s200, bl4s210, and bl5s220) take advantage of the rabbit microprocessor’s internal clock doubler. A built-in clock doubler allows half-frequency crystals to be used to reduce radiated ...

  • Page 48

    Bl4s200 user’s manual 48 3.8.2 spectrum spreader the rabbit microprocessors features a spectrum spreader, which help to mitigate emi problems. By default, the spectrum spreader is on automatically, but it may also be turned off or set to a stronger setting. The means for doing so is through a simple...

  • Page 49

    Bl4s200 user’s manual 49 3.9 memory 3.9.1 sram the rabbitcore modules used with the bl4s200 boards all have 512 kb of data sram. The rabbitcore modules on the bl4s200 and bl5s220 boards also have 512 kb and 1 mb of fast program execution sram. 3.9.2 flash memory the rabbitcore modules used with the ...

  • Page 50

    Bl4s200 user’s manual 50 figure 20. Insertion/removal of microsd card note: when using the dynamic c fat file system, do not remove or insert the microsd™ card while led ds4 above the microsd™ card is on to indicate that the microsd™ card is mounted. The led will go off when the microsd™ card is unm...

  • Page 51: 4.  S

    Bl4s200 user’s manual 51 4. S oftware dynamic c is an integrated development system for writing embedded software. It runs on an ibm-compatible pc and is designed for use with single-board computers and other devices based on the rabbit microprocessor. Chapter 4 provides the libraries, function call...

  • Page 52

    Bl4s200 user’s manual 52 dynamic c has a number of standard features: • full-feature source and/or assembly-level debugger, no in-circuit emulator required. • royalty-free tcp/ip stack with source code and most common protocols. • hundreds of functions in source-code libraries and sample programs: ...

  • Page 53

    Bl4s200 user’s manual 53 4.1.1 upgrading dynamic c 4.1.1.1 patches and updates dynamic c patches that focus on bug fixes and updates are available from time to time. Check the web site at www.Rabbit.Com/support/ for the latest patches, workarounds, and updates. The default installation of a patch or...

  • Page 54

    Bl4s200 user’s manual 54 4.2 sample programs sample programs are provided in the dynamic c samples folder. The sample program pong.C demonstrates the output to the stdio window. The various directories in the samples folder contain specific sample programs that illus- trate the use of the correspond...

  • Page 55

    Bl4s200 user’s manual 55 4.2.1 digital i/o the following sample programs are found in the samples\blxs2xx\dio subdirectory. Figure 21 shows the signal connections for the sample programs that illustrate the use of the digital inputs. Figure 21. Digital inputs signal connections • digin.C —demonstrat...

  • Page 56

    Bl4s200 user’s manual 56 figure 22 shows the signal connections for the sample programs that illustrate the use of the digital outputs. Figure 22. Digital outputs signal connections • digout.C —demonstrates the use of the configurable i/o sinking outputs. Using the demonstration board, you can see a...

  • Page 57

    Bl4s200 user’s manual 57 figure 23 shows the signal connections for the sample program that illustrates the use of the high-current outputs. Note that the regular power-supply connection is substituted by hout0, which operates in the sourcing mode to supply power for this sample program. Figure 23. ...

  • Page 58

    Bl4s200 user’s manual 58 • ppm.C —demonstrates the use of four ppm channels on the configurable i/o pins dio0, dio2, dio4, and dio6 on connector j10. The ppm signals are set for a frequency of 200 hz, with the duty cycle adjustable from 0 to 100% and an offset adjustable from 0 to 100% by the user. ...

  • Page 59

    Bl4s200 user’s manual 59 • quadrature_decoder.C —demonstrates the use of quadrature decoders on the bl4s200. See figure 24 for hookup instructions of configurable i/o pins dio0–dio6 on connector j10 with the demonstration board. Figure 24. Quadrature decoder signal connections once the connections h...

  • Page 60

    Bl4s200 user’s manual 60 4.2.2 serial communication the following sample programs are found in the samples\blxs2xx\rs232 subdirectory. • parity.C —this sample program repeatedly sends byte values 0–127 from serial port f to serial port e. The program switches between generating parity and not genera...

  • Page 61

    Bl4s200 user’s manual 61 • simple5wire.C —this program demonstrates 5-wire rs-232 serial communication using the dynamic c stdio window. Follow these instructions before running this sample program. The bl4s210 model only has one rs-232 serial port available, and so this sample program cannot be run...

  • Page 62

    Bl4s200 user’s manual 62 4.2.3 a/d converter inputs the following sample programs are found in the samples\blxs2xx\adc subdirectory. You will need a separate power supply and a multimeter to use with these sample programs. Note: the calibration sample programs will overwrite the calibration constant...

  • Page 63

    Bl4s200 user’s manual 63 • ad_rd_diff.C —demonstrates how to read and display voltage and equivalent values for a differential a/d converter channel using calibration coefficients previously stored in the user block. The user selects to display either the raw data or the voltage equivalent. Once you...

  • Page 64

    Bl4s200 user’s manual 64 4.2.4 d/a converter outputs the following sample programs are found in the samples\blxs2xx\dac subdirectory. Note: the calibration sample programs will overwrite the calibration constants set at the factory. • dac_cal_ma.C —demonstrates how to recalibrate a d/a converter cha...

  • Page 65

    Bl4s200 user’s manual 65 output and a resistor from 50  to 400 , then compile and run the sample program, and follow the instructions in the dynamic c stdio window. • dac_rd_caldata.C —demonstrates how to display the calibration coefficients, gain and offset, in the dynamic c stdio window for each...

  • Page 66

    Bl4s200 user’s manual 66 4.2.5 use of microsd™ cards with bl4s200 model the following sample program can be found in the samples\blxs2xx\sd_flash folder. • sdflash_inspect.C —this program is a utility for inspecting the contents of a microsd™ card. It provides examples of both reading and writing pa...

  • Page 67

    Bl4s200 user’s manual 67 4.3 bl4s200 libraries two library directories provide libraries of function calls that are used to develop applica- tions for the bl4s200. • blxs2xx —libraries associated with features specific to the bl4s200. The functions in the blxs2xx.Lib library are described in section...

  • Page 68

    Bl4s200 user’s manual 68 4.4 bl4s200 function calls 4.4.1 board initialization brdinit void brdinit (void); function description call this function at the beginning of your program. This function initializes the system i/o ports. The ports are initialized according to table a-3 in appendix a..

  • Page 69

    Bl4s200 user’s manual 69 4.4.2 digital i/o setdigin int setdigin(int channel); function description sets a configurable i/o channel to be a general digital input. Parameters channel configurable i/o channel to be set as an input, 0–31 (pins dio0–dio31) return value 0 — success. -einval — invalid par...

  • Page 70

    Bl4s200 user’s manual 70 diginbank int diginbank(int bank); function description reads the state of the 32 configurable i/o channels. Parameter bank digital input bank pins: 0 — dio0–dio7 1 — dio8–dio15 2 — dio16–dio23 3 — dio24–dio31 return value data read from the bank of digital inputs. -einval —...

  • Page 71

    Bl4s200 user’s manual 71 setextinterrupt int setextinterrupt(int channel, char edge, int handle); function description sets the specified channel to be an interrupt. The interrupt can be configured as a rising edge, falling edge, or either edge. Parameters channel input channel to be configured as a...

  • Page 72

    Bl4s200 user’s manual 72 setdecoder int setdecoder(int channel_a, int channel_b, int channel_index, char index_polarity); function description sets up quadrature decoder functionality on the specified channels. The quadrature decoder may optionally use an index channel. Parameters channel_a channel ...

  • Page 73

    Bl4s200 user’s manual 73 setcounter int setcounter(int channel, int mode, int edge, word options); function description sets up the channel as a counter input, with selectable modes and edge settings. The counter will increment or decrement on each selected edge event. Use getcounter() to read the c...

  • Page 74

    Bl4s200 user’s manual 74 setcounter (continued) return value 0 — success. -einval — invalid parameter value or pin use. -eperm — pin type does not permit this function. -eaccess — resource needed by this function is not available. -efault — internal data fault detected. Positive number — mode confli...

  • Page 75

    Bl4s200 user’s manual 75 setcapture int setcapture(int channel, int mode, int edge, word options); function description sets up the channel as an event capture input, with selectable modes and edge settings. The counter will run from a gated main or prescaled clock signal based on the run cri- teria...

  • Page 76

    Bl4s200 user’s manual 76 setcapture (continued) options options based on mode: bl_cnt_til_end — begin input and edge can be selected all others modes — end input and edge can be selected. For all modes, the prescale clock and save limit flags can be used (or in). For input and edge selection, use: l...

  • Page 77

    Bl4s200 user’s manual 77 getcounter int getcounter(int channel, word *count); function description reads the current count of the counter register within the counter block hosting the given channel. Parameters channel a channel that uses the desired counter block count pointer to word variable to pl...

  • Page 78

    Bl4s200 user’s manual 78 getend int getend(int channel, word *end); function description reads the current value of the end register within the counter block hosting the given channel. Parameters channel a channel that uses the desired counter block begin pointer to word variable to place end regist...

  • Page 79

    Bl4s200 user’s manual 79 setlimit int setlimit(int channel, word limit); function description sets the value of the limit register within the counter block hosting the given channel. This new value will take effect on the next counter overflow or by resetting the counter via the resetcounter() funct...

  • Page 80

    Bl4s200 user’s manual 80 setsync int setsync(int channel, int source, int edge); function description sets the synch for the block the channel is associated with. Note that when more than one block is synchronized to the same synch signal (global or external), each block has its own independent edge...

  • Page 81

    Bl4s200 user’s manual 81 globalsync int globalsync(void); function description sends a single pulse to the global synch inputs of all rio chips. +note that when more than one block is synchronized to the same synch signal (global or external), each block has its own independent edge-detection circui...

  • Page 82

    Bl4s200 user’s manual 82 digout void digout(int channel, int state); function description sets the state of a configurable i/o channel configured as a sinking digital output to a logic 0 or a logic 1. This function will only allow control of pins that are configured by the setdigout() function call ...

  • Page 83

    Bl4s200 user’s manual 83 digoutbank int digoutbank(char bank, char data); function description sets the state (logic 0 or logic 1) of a bank of 8 digital output pins within one of 4 banks to the states contained in the data parameter. This function only updates the channels that are configured to be...

  • Page 84

    Bl4s200 user’s manual 84 setpwm int setpwm(int channel, float frequency, float duty, char invert, char bind); function description sets up a pwm output on the selected configurable i/o channel with the specified fre- quency and duty cycle. The pwm output can be inverted. The pwm channel duty cycle c...

  • Page 85

    Bl4s200 user’s manual 85 setpwm (continued) return value 0 — success. -einval — invalid parameter value. -eperm — pin type does not permit this function. -eacces — resource needed by this function is not available. -efault — internal data fault detected. Positive number — mode conflict — the positiv...

  • Page 86

    Bl4s200 user’s manual 86 setppm int setppm(int channel, float frequency, float offset, float duty, char invert, char bind_offset, char bind_duty); function description sets up a ppm output on the selected configurable i/o channel with the specified frequency and duty cycle. The ppm output of the ppm...

  • Page 87

    Bl4s200 user’s manual 87 setppm (continued) bind_duty use bl_bind_lead or bl_bind_trail to enable binding for the trailing edge of the ppm signal to another pwm or ppm output on a channel hosted by same rio chip and block return value 0 — success. -einval — invalid parameter value. -eperm — pin type...

  • Page 88

    Bl4s200 user’s manual 88 setfreq int setfreq(int channel, float frequency); function description sets the frequency of all the pwm or ppm outputs on the same block as the channel. Will preserve the duty cycle and offset percentages for all of the channels on the same block. This function call is for...

  • Page 89

    Bl4s200 user’s manual 89 setduty int setduty(int channel, float duty); function description sets the duty cycle of the pwm or ppm output on a configurable i/o channel. Will affect any pwm/ppm that has been bound to this channel’s pwm/ppm. Note: configurable i/o channels dio30 and dio31 do not suppor...

  • Page 90

    Bl4s200 user’s manual 90 setoffset int setoffset(int channel, float offset); function description sets the offset of a ppm output on a configurable i/o channel. Will affect any pwm/ ppm output that has been bound to this channel’s ppm signal. Note: configurable i/o channels dio30 and dio31 do not su...

  • Page 91

    Bl4s200 user’s manual 91 pulsedisable int pulsedisable(int channel, int state); function description disables a pwm/ppm output and sets the output to state . The pin can be restored to the same pwm/ppm operation as before by calling pulseenable() . Parameters channel channel that is getting its pwm/...

  • Page 92

    Bl4s200 user’s manual 92 4.4.3 high-current outputs digoutconfig_h int digoutconfig_h(char configuration); function description sets the configuration of a high-current output to be a sinking or sourcing type output. Upon configuration, the output will be set initially to a high-impedance tristate. ...

  • Page 93

    Bl4s200 user’s manual 93 digout_h int digout_h(int channel, int state); function description sets the state of the selected high-current output channel to a logic 0, logic 1, or high- impedance tristate output. Parameters channel high-current output pins 0 to 7 (hout0–hout7) state sets a given chann...

  • Page 94

    Bl4s200 user’s manual 94 digouttristateconfig_h int digouttristateconfig_h(char configuration); function description allows configuration of a high-current output to be a tristate type output. Upon config- uration, the output will be initially set to a high-impedance state. Note: configuring a given...

  • Page 95

    Bl4s200 user’s manual 95 digouttristate_h int digouttristate_h(int channel, int state) function description sets the state of the high-current output channel to a logic 0, logic 1, or high-impedance tristate. Parameters channel high-current output pins 0 to 7 (hout0–hout7) state sets a given channel...

  • Page 96

    Bl4s200 user’s manual 96 setpwm_h int setpwm_h(int channel, float frequency, float duty, char mode, char bind); function description sets up a pwm output on the selected high-current output channel with the specified frequency and duty cycle. The pwm output can be set to any of its three states duri...

  • Page 97

    Bl4s200 user’s manual 97 setpwm_h (continued) return value 0 — success. -einval — invalid parameter value. -eperm — pin type does not permit this function. -eacces — resource needed by this function is not available. -efault — internal data fault detected. Positive number — mode conflict — the posit...

  • Page 98

    Bl4s200 user’s manual 98 setppm_h int setppm_h(int channel, float frequency, float offset, float duty, char mode, char bind_offset, char bind_duty); function description sets up a ppm output on the selected high-current output channel with the specified frequency, offset, and duty cycle. The ppm out...

  • Page 99

    Bl4s200 user’s manual 99 setppm_h (continued) bind_duty use bl_bind_lead or bl_bind_trail to enable binding for the trailing edge of the ppm signal to another pwm or ppm output on a channel hosted by same rio chip and block return value 0 — success. -einval — invalid parameter value. -eperm — pin ty...

  • Page 100

    Bl4s200 user’s manual 100 setfreq_h int setfreq_h(int channel, float frequency); function description sets the frequency of all the pwm or ppm outputs on the same block as the channel. Will preserve the duty cycle and offset percentages for all of the channels on the same block. This function call i...

  • Page 101

    Bl4s200 user’s manual 101 setduty_h int setduty_h(int channel, float duty); function description sets the duty cycle of the pwm or ppm output on a high-current output channel. Will affect any pwm/ppm that has been bound to this channel’s pwm/ppm. Parameters channel channel that is getting its duty c...

  • Page 102

    Bl4s200 user’s manual 102 setoffset_h int setoffset_h(int channel, float offset); function description sets the offset of a ppm output on a high-current output channel. Will affect any pwm/ ppm output that has been bound to this channel’s ppm signal. Parameters channel channel that is getting its of...

  • Page 103

    Bl4s200 user’s manual 103 setsync_h int setsync_h(int channel, int edge); function description enables or disables the global synch for the block the high-current output channel is associated with. Parameters channel channel that is on the block that will have its synch set edge edge of the synch si...

  • Page 104

    Bl4s200 user’s manual 104 4.4.4 rabbit rio interrupt handlers addisr int addisr(int channel, int io, int ier, void (*handler)()); function description adds an interrupt handler for the interrupts specified in the ier parameter for the given rio block hosting the given configurable i/o pin. The inter...

  • Page 105

    Bl4s200 user’s manual 105 addisr_h int addisr_h(int channel, int ier, void (*handler)()); function description adds an interrupt handler for the interrupts specified in the ier parameter for the given rio block hosting the given high-current output pin. The interrupt service routine (isr) is always ...

  • Page 106

    Bl4s200 user’s manual 106 setier int setier(int isr_handle, int ier); function description sets the interrupt enable register (ier) mask for an interrupt handler. Note that the in- terrupt handler must be currently disabled to set the ier value. Disabling the isr can be done by calling enableisr() w...

  • Page 107

    Bl4s200 user’s manual 107 enableisr int enableisr(int isr_handle, int enable) function description enables or disables an interrupt handler. Parameters isr_handle index to the desired isr enable non-zero enables the isr, zero disables the isr return value 0 — success. -einval — invalid parameter giv...

  • Page 108

    Bl4s200 user’s manual 108 4.4.5 serial communication library files included with dynamic c provide a full range of serial communications sup- port. The rs232.Lib library provides a set of circular-buffer-based serial functions. The packet.Lib library provides packet-based serial functions where pack...

  • Page 109

    Bl4s200 user’s manual 109 ser485tx void ser485tx(void); function description enables the rs-485 transmitter. Sermode() must be executed before running this function call. Note: transmitted data are echoed back into the receive data buffer. The echoed data could be used to identify when to disable th...

  • Page 110

    Bl4s200 user’s manual 110 4.4.6 a/d converter inputs anainconfig void anainconfig(int channel, int opmode); function description configures an a/d converter input channel for a given mode of operation. This func- tion must be called before accessing the a/d converter chip. The configuration of the a...

  • Page 111

    Bl4s200 user’s manual 111 anainconfig (continued) parameters channel analog input channel, 0–7 (ain0–ain7) opmode selects the mode of operation for the a/d converter channel pair. The values are as follows: se0_mode — single-ended unipolar (0–20 v) se1_mode — single-ended bipolar (±10 v) diff_mode —...

  • Page 112

    Bl4s200 user’s manual 112 anaincalib int anaincalib(int channel, int opmode, int gaincode, int value1, float volts1, int value2, float volts2); function description calibrates the response of a given a/d converter channel as a linear function using the two conversion points provided. Gain and offset...

  • Page 113

    Bl4s200 user’s manual 113 anaincalib (continued) gaincode the gain code of 0 to 7 (use a gain code of 4 for 4–20 ma operation) value1 the first a/d converter value volts1 the voltage corresponding to the first a/d converter value value2 the second a/d converter value volts2 the voltage corresponding...

  • Page 114

    Bl4s200 user’s manual 114 anain int anain(int channel, int gaincode); function description reads the state of an a/d converter input channel. If the access is for an a/d converter single-ended bipolar channel and the gain code for the given channel has changed from the previous cycle, the user block...

  • Page 115

    Bl4s200 user’s manual 115 anain (continued) return value a value corresponding to the voltage on the analog input channel: 0–2047 for 11-bit a/d conversions, or a value of bl_errcodestart or less to indicate an error condition: a/d converter operation errors (will not create run-time error): bl_spib...

  • Page 116

    Bl4s200 user’s manual 116 anainvolts float anainvolts(int channel, int gaincode); function description reads the state of a single-ended a/d converter input channel and uses the previously set calibration constants to convert it to volts. The voltage ranges given in the table be- low are nominal ran...

  • Page 117

    Bl4s200 user’s manual 117 anainvolts (continued) return value a voltage on the analog input channel, or a value of bl_errcodestart or less to in- dicate an error condition: a/d converter operation errors (will not create run-time error): bl_not_cal — a/d converter is not calibrated for this channel/...

  • Page 118

    Bl4s200 user’s manual 118 anaindiff float anaindiff(int channel, int gaincode); function description reads the state of a differential a/d converter input channel and uses the previously set calibration constants to convert it to volts. Voltage ranges given in the table below are the nominal ranges ...

  • Page 119

    Bl4s200 user’s manual 119 anaindiff (continued) return value a voltage on the analog input channel, or a value of bl_errcodestart or less to indicate an error condition: a/d converter operation errors (will not create run-time error): bl_not_cal — a/d converter is not calibrated for this channel/gai...

  • Page 120

    Bl4s200 user’s manual 120 anainmamps float anainmamps(int channel); function description reads the state of a single-ended a/d converter input channel and uses the previously set calibration constants to convert it to a floating-point current value in milli amps. The nominal range is 0 ma to 20 ma, ...

  • Page 121

    Bl4s200 user’s manual 121 anaindriver int anaindriver(char cmd); function description low-level driver to read the ads7870 a/d converter chip. Parameter cmd the cmd parameter contains a gain code and channel code, and the msb is set high for direct-mode access. The format is as follows: use the foll...

  • Page 122

    Bl4s200 user’s manual 122 anaindriver (continued) the bl4s200 boards were designed to extend the a/d converter input circuit configu- rations, which is done by the anainconfig() function call. The following table maps the bl4s200 a/d converter configurations to the a/d converter channel_code listed ...

  • Page 123

    Bl4s200 user’s manual 123 4.4.7 d/a converter outputs anaoutconfig int anaoutconfig(char polarity, int mode); function description configures the d/a converter chip for a given output voltage range, 0–10 v or ±10 v, and loads the calibration data for use by the d/a converter function calls. This fun...

  • Page 124

    Bl4s200 user’s manual 124 anaoutstrobe int anaoutstrobe(int channels); function description outputs the previously written value of each channel indicated by the input parameter. This function is only useful when the d/a converter is configured for synchronous mode operation because each channel is ...

  • Page 125

    Bl4s200 user’s manual 125 anaoutpwroff int anaoutpwroff(bl_power_t mode); function description this function enables or disables the bl4s200 power supply that is used to power the d/a converter voltage or current output circuits. Parameter mode d/a converter power-off mode. Bl_high_z (0) — high outp...

  • Page 126

    Bl4s200 user’s manual 126 anaoutcalib int anaoutcalib(int channel, int calib_index, int value1, float volts1, int value2, float volts2); function description calibrates the response of a given d/a converter channel as a linear function with using two conversion points provided by the user. Gain and ...

  • Page 127

    Bl4s200 user’s manual 127 anaout void anaout(int ch, int rawdata); function description sets the voltage of a d/a converter output channel. Parameters ch the d/a converter output channel (0–1) corresponding to aout0–aout1 rawdata data value corresponding to the voltage desired on the output channel ...

  • Page 128

    Bl4s200 user’s manual 128 anaoutvolts void anaoutvolts(int ch, float voltage); function description sets the voltage of a d/a converter output channel by using the previously set calibra- tion constants to calculate the correct data values. Parameters ch the d/a converter output channel (0–1) corres...

  • Page 129

    Bl4s200 user’s manual 129 anaoutmamps void anaoutmamps(int ch, float current); function description sets the current of a d/a converter output channel by using the previously set calibra- tion constants to calculate the correct data values. Parameters ch the d/a converter output channel (0–1) corres...

  • Page 130

    Bl4s200 user’s manual 130 anaoutdriver int anaoutdriver(unsigned int cmd) function description low-level driver to read the dac128s085 d/a converter chip. It handles writing the rawdata output value to the d/a converter chip. The synch/asynch d/a converter mode is critical for determining whether a ...

  • Page 131

    Bl4s200 user’s manual 131 4.4.8 sram use the bl4s200 model and some memory variations described in table 1 have a battery- backed data sram and a program-execution sram. Dynamic c provides the protected keyword to identify variables that are to be placed into the battery-backed sram. The compiler ge...

  • Page 132: 5.  U

    Bl4s200 user’s manual 132 5. U sing the e thernet tcp/ip f eatures chapter 5 discusses using the ethernet tcp/ip features on the bl4s200 boards. Ethernet is not available on bl5s220 and bl4s230 models, which have wireless network interfaces. 5.1 tcp/ip connections before proceeding you will need to ...

  • Page 133

    Bl4s200 user’s manual 133 figure 25. Ethernet connections the pc running dynamic c through the serial programming port on the bl4s200 does not need to be the pc with the ethernet card. 3. Apply power plug in the ac adapter. The bl4s200 is now ready to be used. Note: a hardware reset is accomplished ...

  • Page 134

    Bl4s200 user’s manual 134 5.2 tcp/ip sample programs we have provided a number of sample programs demonstrating various uses of tcp/ip for networking embedded systems. These programs require that you connect your pc and the bl4s200 together on the same network. This network can be a local private ne...

  • Page 135

    Bl4s200 user’s manual 135 5.2.2 how to set up your computer for direct connect follow these instructions to set up your pc or notebook. Check with your administrator if you are unable to change the settings as described here since you may need administrator privileges. The instructions are specifica...

  • Page 136

    Bl4s200 user’s manual 136 5.2.3 run the pingme.C demo connect the crossover cable from your computer’s ethernet port to the bl4s200’s rj-45 ethernet connector. Open this sample program from the samples\tcpip\icmp folder, compile the program, and start it running under dynamic c. When the program sta...

  • Page 137

    Bl4s200 user’s manual 137 5.2.4 running more demo programs with a direct connection the program ssi.C ( samples\blxs2xx\tcpip\ ) demonstrates how to make the bl4s200 a web server. This program allows you to turn the leds on an attached demon- stration board from the tool kit on and off from a remote...

  • Page 138: 6.  U

    Bl4s200 user’s manual 138 6. U sing the w i -f i f eatures chapter 6 discusses using the tcp/ip wi-fi features on the bl5s220 board. This networking feature is not available on other bl4s200 models, which have other network interfaces. 6.1 introduction to wi-fi wi-fi, a popular name for 802.11b/g, r...

  • Page 139

    Bl4s200 user’s manual 139 once the access point is discovered, the device will logically join the access point and announce itself. Once joined, the device can transmit and receive data packets much like an ethernet-based mac. Being in a joined state is akin to having link status in a 10/100base-t n...

  • Page 140

    Bl4s200 user’s manual 140 6.2 running wi-fi sample programs in order to run the sample programs discussed in this chapter and elsewhere in this manual, 1. Your module must be installed on the bl5s220 motherboard. 2. Dynamic c must be installed and running on your pc. 3. The programming cable must co...

  • Page 141

    Bl4s200 user’s manual 141 6.2.1 wi-fi setup figure 26 shows how your development setup might look once you’re ready to proceed. Figure 26. Wi-fi host setup ethernet ethernet hub infrastructure mode (via ethernet connection) ad-hoc mode infrastructure mode (via wireless connection) d1 r1 pwr ds1 gnd ...

  • Page 142

    Bl4s200 user’s manual 142 6.2.2 what else you will need besides what is supplied with the bl4s200 tool kit, you will need a pc with an available usb port to program the bl5s220. You will need either an access point for an existing wi-fi network that you are allowed to access and have a pc or noteboo...

  • Page 143

    Bl4s200 user’s manual 143 6.2.3 configuration information 6.2.3.1 network/wi-fi configuration any device placed on an ethernet-based internet protocol (ip) network must have its own ip address. Ip addresses are 32-bit numbers that uniquely identify a device. Besides the ip address, we also need a ne...

  • Page 144

    Bl4s200 user’s manual 144 6.2.3.2 pc/laptop/pda configuration this section shows how to configure your pc or notebook to run the sample programs. Here we’re mainly interested in the pc or notebook that will be communicating wirelessly, which is not necessarily the pc that is being used to compile an...

  • Page 145

    Bl4s200 user’s manual 145 infrastructure mode (via wireless connection) set the ip address and netmask for your wireless-enabled pc or notebook as described in step 2 for infrastructure mode (via ethernet connection) by clicking on network connections , then on local area connection . Now click on w...

  • Page 146

    Bl4s200 user’s manual 146 once the pc or notebook is set up, we're ready to communicate. You can use telnet or a web browser such as internet explorer, which come with most windows installations, to use the network interface, and you can use hyperterminal to view the serial port when these are calle...

  • Page 147

    Bl4s200 user’s manual 147 other requirements. Any attempt to operate a device outside the allowed channel range or power limits will void your regulatory approval to operate the device in that country. Before you compile and run this sample program, uncomment the #define ifc_ wifi_region line corres...

  • Page 148

    Bl4s200 user’s manual 148 before you compile and run this sample program, check the tcp/ip configuration parameters, the ip address, and the ssid in the macros, which are reproduced below. #define tcpconfig 1 // #define wifi_region_verbose #define ping_who "10.10.6.1" #define _primary_static_ip "10....

  • Page 149

    Bl4s200 user’s manual 149 you do not need to configure the ssid of your network since that is done from the access point names. Now configure the access to the two access points. // first access point #define ap_0 "test1" #define ap_0_len strlen(ap_0) #define my_address_0 "10.10.6.250" // use this s...

  • Page 150

    Bl4s200 user’s manual 150 • wifiscan.C —initializes the bl5s220 and scans for other wi-fi devices that are operating in either the ad-hoc mode or through access points in the infrastructure mode. No network parameter settings are needed since the bl5s220 does not actually join an 802.11 network. Thi...

  • Page 151

    Bl4s200 user’s manual 151 the data passed to the callback function are ephemeral since another scan may occur. Thus, the data need to be used (or copied) during the callback function. While waiting for user input, it is important to keep the network alive by calling tcp_tick(null) regularly. 6.2.5 r...

  • Page 152

    Bl4s200 user’s manual 152 the next macro specifies a suitable pre-shared key to use instead of the passphrase. The key may be entered either as 64 hexadecimal digits or as an ascii string of up to 63 characters. #define ifc_wifi_wpa_psk_hexstr tip: there is a good chance of typos since the key is lo...

  • Page 153

    Bl4s200 user’s manual 153 • pingled_wpa2_ccmp.C —this sample program is an extension of pingled.C . It demonstrates the use of wpa2 psk (wi-fi protected access with pre-shared key).). Wpa is a more secure replacement for wep. The implementation in the sample pro- gram uses the advanced encryption st...

  • Page 154

    Bl4s200 user’s manual 154 6.3 dynamic c wi-fi configurations rabbit has implemented a packet driver for the bl5s220 that functions much like an eth- ernet driver for the dynamic c implementation of the tcp/ip protocol stack. In addition to functioning like an ethernet packet driver, this driver impl...

  • Page 155

    Bl4s200 user’s manual 155 • your own channel— ifc_wifi_channel determines the channel on which to operate. Define it to a string, not an integer. The default is shown below. #define ifc_wifi_channel 0 the default 0 means that any valid channel may be used by the requested ssid. This parameter is man...

  • Page 156

    Bl4s200 user’s manual 156 these macros specify the wep keys to use for wep encryption. These keys can be either 40-bit or 104-bit (i.E., 5 bytes or 13 bytes). They must be defined as a comma- separated list of byte values. Note that you do not necessarily need to define all four wep keys. You may ty...

  • Page 157

    Bl4s200 user’s manual 157 the following authentication options are available. • ifparam_wifi_auth_open — only use open authentication . • ifparam_wifi_auth_sharedkey — only use shared-key authentication (useful for wep only) . • ifparam_wifi_wpa_psk — use wpa preshared-key authentication (useful for...

  • Page 158

    Bl4s200 user’s manual 158 6.3.2 configuring tcp/ip at run time there is one basic function call used to configure wi-fi and other network settings — ifconfig() . See the dynamic c tcp/ip user’s manual, volume 1 for more informa- tion about this function call. 6.3.3 other key function calls remember ...

  • Page 159

    Bl4s200 user’s manual 159 6.4 where do i go from here? Note: if you purchased your bl5s220 through a distributor or through a rabbit partner, contact the distributor or partner first for technical support. If there are any problems at this point: • use the dynamic c help menu to get further assistan...

  • Page 160: 7.  U

    Bl4s200 user’s manual 160 7. U sing the z ig b ee f eatures chapter 7 discusses using the zigbee features on the bl4s230 board. This networking feature is not available on other bl4s200 models, which have other network interfaces. 7.1 introduction to the zigbee protocol the zigbee pro specification ...

  • Page 161

    Bl4s200 user’s manual 161 an introduction to zigbee provides background information on the zigbee protocol, and is available on the cd and on our web site . 7.2 zigbee sample programs in order to run the sample programs discussed in this chapter and elsewhere in this manual, 1. Dynamic c must be ins...

  • Page 162

    Bl4s200 user’s manual 162 7.2.1 setting up the digi xbee usb coordinator 1. Connect the digi ® xbee usb acting as a zigbee coordinator to an available usb port on your pc or workstation. Your pc should recognize the new usb hardware. 2. Connect the demonstration board to the bl4s230 as shown below. ...

  • Page 163

    Bl4s200 user’s manual 163 5. Confirm the following hardware setup is displayed on the “pc settings” tab. Now select the com port the digi ® xbee usb is connected to, and click the “open com port” button. The message “radio found” is displayed to indicate that you selected the correct com port. The z...

  • Page 164

    Bl4s200 user’s manual 164 7. Select a device with your mouse pointer and click on the selected device to select that device. This device will now be displayed in the “selected device” area. 8. You are now ready to interface with the bl4s230 via the zigbee protocol. Try pinging the selected device by...

  • Page 165

    Bl4s200 user’s manual 165 channel mask — defaults to 0x1ffe, i.E., all 16 possible channels via the macro in the dynamic c lib\rabbit4000\xbee\xbee_firmware\xbee_api.Lib library. If you want to limit the channels used, all devices on your network should use the same channel mask. #define default_cha...

  • Page 166

    Bl4s200 user’s manual 166 the xbee sample program in the dynamic c samples\blxs2xx\xbee folder illustrates the use of the xbee function calls. • xbee_gpio_server.C —this sample program shows how to set up and use endpoints and clusters. It is meant to be run with the windows gui client (installed in...

  • Page 167

    Bl4s200 user’s manual 167 7.3 dynamic c function calls function calls for use with the xbee rf modules are in the dynamic c lib\rabbit4000\ xbee\xbee_api.Lib library. These zigbee specific function calls are described in an introduction to zigbee, which is included in the online documentation set. 7...

  • Page 168: Ppendix

    Bl4s200 user’s manual 168 a ppendix a. S pecifications appendix a provides the specifications for the bl4s200 and describes the conformal coating..

  • Page 169

    Bl4s200 user’s manual 169 a.1 electrical and mechanical specifications figures a-1(a) and a-1(b) show the mechanical dimensions for the bl4s200. Figure a-1(a). Bl4s200/bl4s210 dimensions note: all measurements are in inches followed by millimeters enclosed in parentheses. All dimensions have a manuf...

  • Page 170

    Bl4s200 user’s manual 170 figure a-1(b). Bl5s220/bl4s230 dimensions note: all measurements are in inches followed by millimeters enclosed in parentheses. All dimensions have a manufacturing tolerance of ±0.01" (0.25 mm). Reset s1 s2 r1 core +3.3 v ds1 ds2 j9 j10 j11 j12 j8 j7 j6 j5 j4 j3 j2 j1 rcm1 ...

  • Page 171

    Bl4s200 user’s manual 171 table a-1 lists the electrical, mechanical, and environmental specifications for the bl4s200. Table a-1. Bl4s200 specifications feature bl4s200 bl4s210 bl5s220 bl4s230 microprocessor rabbit 4000 ® at 58.98 mhz rabbit ® 5000 at 73.73 mhz rabbit 4000 ® at 29.49 mhz network in...

  • Page 172

    Bl4s200 user’s manual 172 serial ports 5 serial ports: • one rs-485 • two rs-232 or one rs- 232 (with cts/rts) • one clocked serial port multiplexed to two rs-422 spi master ports • one serial port dedi- cated for pro- gramming/ debug 4 serial ports: • one rs-485 • one rs-232 (no cts/ rts)) • one cl...

  • Page 173

    Bl4s200 user’s manual 173 a.1.1 exclusion zone it is recommended that you allow for an “exclusion zone” of 0.25" (6 mm) around the bl4s200 in all directions when the bl4s200 is incorporated into an assembly that includes other components. This “exclusion zone” that you keep free of other components ...

  • Page 174

    Bl4s200 user’s manual 174 a.2 conformal coating the areas around the crystal oscillator and the battery backup circuit on the bl4s200 modules based on the rabbit 4000 microprocessor have had the dow corning silicone- based 1-2620 conformal coating applied. The conformal coating protects these high- ...

  • Page 175

    Bl4s200 user’s manual 175 a.3 jumper configurations figure a-3 shows the header locations used to configure the various bl4s200 options via jumpers. Figure a-3. Location of bl4s200 configurable positions table a-2 lists the configuration options. Table a-2. Bl4s200 jumper configurations header descr...

  • Page 176

    Bl4s200 user’s manual 176 jp3 aout0 1–2 3–4 0 to +10 v d/a converter output × 5–6 ±10 v d/a convert output jp4 a/d converter voltage/current measurement options none voltage option × 1–2 ain0 4–20 ma option 3–4 ain1 4–20 ma option 5–6 ain2 4–20 ma option 7–8 ain3 4–20 ma option jp5 aout0 1–3 d/a con...

  • Page 177

    Bl4s200 user’s manual 177 a.4 use of rabbit microprocessor parallel ports table a-3 lists the rabbit microprocessor parallel ports and their use in the bl4s200 boards. Table a-3. Use of rabbit microprocessor parallel ports port i/o signal initial state pa0–pa7 i/o id0–id7 pulled up pb0 input adc bus...

  • Page 178: Ppendix

    Bl4s200 user’s manual 178 a ppendix b. P ower s upply appendix b describes the power circuitry provided on the bl4s200. B.1 power supplies power is supplied to the bl4s200 boards via the micro-fit ® connector at j5. The bl4s200 is protected against reverse polarity by a diode at d10 as shown in figu...

  • Page 179

    Bl4s200 user’s manual 179 the digital ground and the analog ground share a single split ground plane on the board, with the analog ground connected at a single point to the digital ground by a 0  resistor (r95). This is done to minimize digital noise in the analog circuits and to eliminate the poss...

  • Page 180

    Bl4s200 user’s manual 180 b.2.1 replacing the backup battery the battery is user-replaceable, and is fitted in a battery holder. To replace the battery, lift up on the spring clip and slide out the old battery. Use only a renata cr2032 or equivalent replacement battery, and insert it into the batter...

  • Page 181

    Bl4s200 user’s manual 181 b.3 power to peripheral cards dcin and vcc are available on micro-fit ® connector j7 to power rabbitnet peripheral boards that may be used with the bl4s200. Keep in mind that the bl4s200 draws 377 ma from the vcc supply, and that the diode at d10 (shown in figure b-1) can h...

  • Page 182: Ppendix

    Bl4s200 user’s manual 182 a ppendix c. D emonstration b oard appendix c explains how to use the demonstration board with the bl4s200 sample programs..

  • Page 183

    Bl4s200 user’s manual 183 c.1 connecting demonstration board before running sample programs based on the demonstration board, you will have to con- nect the demonstration board from the bl4s200 tool kit to the bl4s200 board. Proceed as follows. 1. Use the 6-position connector to bare leads wiring ha...

  • Page 184

    Bl4s200 user’s manual 184 c.2 demonstration board features the demonstration board can be used to illustrate i/o activity via leds and pushbutton switches. C.2.1 pinout figure c-2 shows the pinouts for the input signals on screw-terminal header j1 and the outputs on screw-terminal header j3. Figure ...

  • Page 185

    Bl4s200 user’s manual 185 the four led output indicators can be configured as sinking outputs or as sourcing out- puts via jumpers on headers jp1–jp4 as shown in figure c-4. Figure c-4. Led output indicators sinking or sourcing configuration the power supply voltage input at +v on screw-terminal hea...

  • Page 186: Ppendix

    Bl4s200 user’s manual 186 a ppendix d. R abbit rio r esource a llocation appendix d provides the pin and block associations on the rabbit rio chips with their corresponding i/o on the bl4s200 boards. The main shared resource within the rio chips are the counter/timer blocks — each rio chip has eight...

  • Page 187

    Bl4s200 user’s manual 187 d.1 configurable i/o pin associations table d-1. Configurable i/o pin associations i/o pin rio chip inputs outputs block pin block pin dio0 0 5 0 4 0 dio1 1 1 dio2 2 2 dio3 3 3 dio4 1 1 0 0 0 dio5 1 1 dio6 2 2 dio7 3 3 dio8 3 0 2 0 dio9 1 1 dio10 2 2 dio11 3 3 dio12 5 0 4 0...

  • Page 188

    Bl4s200 user’s manual 188 d.2 high-current output pin associations d.3 interpreting error codes some bl4s200 function calls may return a mode conflict error code. This error code is a 4-bit value that identifies other pins using the same counter/timer block on a particular rio chip that require this...

  • Page 189

    Bl4s200 user’s manual 189 the tables in this appendix are useful for both finding the cause of mode conflicts, and for planning which pins to use for which functions to avoid conflicts in the first place. Note that pins dio30 and dio31 do not have their output functionality controlled by a rio chip....

  • Page 190: Ppendix

    Bl4s200 user’s manual 190 a ppendix e. R abbit n et e.1 general rabbitnet description rabbitnet is a high-speed synchronous protocol developed by rabbit to connect periph- eral cards to a master and to allow them to communicate with each other. E.1.1 rabbitnet connections all rabbitnet connections a...

  • Page 191

    Bl4s200 user’s manual 191 use a straight-through cat 5/6 ethernet cable to connect the master to slave peripheral cards, unless you are using a device such as the op7200 that could be used either as a master or a slave. In this case you would use a crossover cat 5/6 ethernet cable to connect an op72...

  • Page 192

    Bl4s200 user’s manual 192 e.2 physical implementation there are four signaling functions associated with a rabbitnet connection. From the mas- ter’s point of view, the transmit function carries information and commands to the periph- eral card. The receive function is used to read back information s...

  • Page 193

    Bl4s200 user’s manual 193 e.3 function calls the function calls described in this section are used with all rabbitnet peripheral cards, and are available in the rnet.Lib library in the dynamic c rabbitnet folder. Rn_init int rn_init(char portflag, char servicetype); function description resets, init...

  • Page 194

    Bl4s200 user’s manual 194 rn_device int rn_device(char pna); function description returns an address index to device information from a given physical node address. This function will check device information to determine that the peripheral card is connected to a master. Parameter pna the physical ...

  • Page 195

    Bl4s200 user’s manual 195 rn_find int rn_find(rn_search *srch); function description locates the first active device that matches the search criteria. Parameter srch search criteria structure rn_search: unsigned int flags; // status flags see match macros below unsigned int ports; // port bitmask ch...

  • Page 196

    Bl4s200 user’s manual 196 rn_echo int rn_echo(int handle, char sendecho, char *recdata); function description the peripheral card sends back the character the master sent. This function will check device information to determine that the peripheral card is connected to a master. Parameters handle ad...

  • Page 197

    Bl4s200 user’s manual 197 rn_read int rn_read(int handle, int regno, char *recdata, int datalen); function description reads a string from the specified device and register. Waits for results. This function will check device information to determine that the peripheral card is connected to a master....

  • Page 198

    Bl4s200 user’s manual 198 rn_reset int rn_reset(int handle, int resettype); function description sends a reset sequence to the specified peripheral card. The reset takes approximately 25 ms before the peripheral card will once again execute the application. Allow 1.5 seconds after the reset has comp...

  • Page 199

    Bl4s200 user’s manual 199 rn_enable_wdt int rn_enable_wdt(int handle, int wdttype); function description enables the hardware and/or software watchdog timers on a peripheral card. The soft- ware on the peripheral card will keep the hardware watchdog timer updated, but will hard reset if the time exp...

  • Page 200

    Bl4s200 user’s manual 200 rn_hitwd int rn_hitwd(int handle, char *count); function description hits software watchdog. Set the timeout period and enable the software watchdog prior to using this function. This function will check device information to determine that the pe- ripheral card is connecte...

  • Page 201

    Bl4s200 user’s manual 201 rn_rst_status int rn_rst_status(int handle, char *retdata); function description reads the status of which reset occurred and whether any watchdogs are enabled. Parameters handle address index to device information. Use rn_device() or rn_find() to establish the handle. Retd...

  • Page 202

    Bl4s200 user’s manual 202 rn_comm_status int rn_comm_status(int handle, char *retdata); function description if the communication error bit is set in the status byte, use this function call to determine the error. Parameters handle address index to device information. Use rn_device() or rn_find() to...

  • Page 203

    Bl4s200 user’s manual 203 e.3.1 status byte unless otherwise specified, functions returning a status byte will have the following format for each designated bit. 7 6 5 4 3 2 1 0 × × 00 = reserved 01 = ready 10 = busy 11 = device not connected × 0 = device 1 = router × 0 = no error 1 = communication ...

  • Page 204: Ppendix

    Bl4s200 user’s manual 204 a ppendix f. A dditional c onfiguration i nstructions appendix f provides information on how to find the latest firm- ware for the xbee rf module and the digi ® xbee usb used as the zigbee coordinator, and how to install the firmware. F.1 xbee module firmware downloads by d...

  • Page 205

    Bl4s200 user’s manual 205 make the following modifications to the modemfwload.C sample program.Before you run it according to whether you will be using the bl4s230 as a coordinator or a router. • select the xbee role macro according to whether the bl4s230 is being used as a coor- dinator or a router...

  • Page 206

    Bl4s200 user’s manual 206 continue the following steps with the digi ® xbee usb connected to your pc’s usb port. Since the zigbee utility xbee_gpio_gui.Exe will conflict with x-ctu, first close the zigbee utility if it is running. 1. Start x-ctu from the desktop icon and set the “pc settings” tab to...

  • Page 207

    Bl4s200 user’s manual 207 with the bl4s230, but the general documentation about zigbee and the use of at com- mands for the xbee™ and the xbee pro™ rf modules is relevant..

  • Page 208

    Bl4s200 user’s manual 208 f.2.2 update digi ® xbee usb firmware the firmware version used by the digi ® xbee usb must correspond to the firmware version installed on the bl4s230. If you have updated the bl4s230 firmware (or you have a need to re-install the firmware on the digi ® xbee usb), the corr...

  • Page 209: Ndex

    Bl4s200 user’s manual 209 i ndex a a/d converter ....................... 40 buffered inputs .................. 40 calibration ......................... 42 calibration constants ......... 41 current-measurement setup 41 function calls anain() ......................... 114 anaincalib() ..................

  • Page 210

    Bl4s200 user’s manual 210 pullup/pulldown configuration 28, 29, 34 switching threshold ........... 28 digital outputs ....................... 34 pwm/ppm setup .............. 33 sinking or sourcing ............ 34 dimensions bl4s200 main board ...... 169 dynamic c .................. 9, 51, 52 add-on ...

  • Page 211

    Bl4s200 user’s manual 211 programming port ................. 38 r rabbit microprocessor parallel ports ................... 177 tamper detection ................ 49 vbat ram memory ....... 49 rabbitnet .............................. 10 ethernet cables to connect pe- ripheral cards ...... 190, 191 fun...

  • Page 212

    Bl4s200 user’s manual 212 programming port ............. 38 rs-232 description ........... 36 rs-485 description ........... 36 rs-485 network ................ 37 rs-485 termination and bias resistors ......................... 37 serial ports ethernet port ..................... 39 setup ...............

  • Page 213: Chematics

    Bl4s200 user’s manual 213 s chematics 090-0267 bl4s200 schematic www.Rabbit.Com/documentation/schemat/090-0267.Pdf 090-0227 rcm4000 schematic www.Rabbit.Com/documentation/schemat/090-0227.Pdf 090-0229 rcm4300 schematic www.Rabbit.Com/documentation/schemat/090-0229.Pdf 090-0266 rcm5400w schematic www...