background image

PulseBlaster

Example Use of C Functions

/*
 * PulseBlaster example 1

 * This program will cause the outputs to turn on and off with a period
 * of 400ms

 */

#include <stdio.h>
#define PB24

#include "spinapi.h"

int main(){

int start, status;

printf ("Using spinapi library version %s\n", pb_get_version());

    

if(pb_init() != 0) {
       

printf ("Error initializing board: %s\n", pb_get_error());    

        

return -1;

    

}

  

// Tell the driver what clock frequency the board has (in MHz)

    

pb_set_clock(100.0);

    

pb_start_programming(PULSE_PROGRAM);

// Instruction 0 - Continue to instruction 1 in 100ms
// Flags = 0xFFFFFF, OPCODE = CONTINUE

start = pb_inst(0xFFFFFF, CONTINUE, 0, 200.0*ms);

    

// Instruction 1 - Continue to instruction 2 in 100ms

    

// Flags = 0x0, OPCODE = CONTINUE

    

pb_inst(0x0, CONTINUE, 0, 100.0*ms);

    

// Instruction 2 - Branch to "start" (Instruction 0) in 100ms

    

// 0x0, OPCODE = BRANCH, Target = start

    

pb_inst(0x0, BRANCH, start, 100.0*ms);

pb_stop_programming();

    

// Trigger the pulse program
pb_start();

//Read the status register

status = pb_read_status();
printf("status: %d", status);

pb_close();

return 0;

}

A more complex program using C Functions is provided in Appendix II.

http://www.spincore.com

5/19/2006

14

Summary of Contents for PulseBlaster PB24-100-32k-PCI

Page 1: ...PulseBlaster PCI Board Rev 01 Owner s Manual Models PB24 100 PCI PB24 100 32k PCI SpinCore Technologies Inc http www spincore com...

Page 2: ...gies Inc reserves the right to make changes to the product s or information herein without notice PulseBlasterDDS PulseBlaster SpinCore and the SpinCore Technologies Inc logos are trademarks of SpinCo...

Page 3: ...nstalling the PulseBlaster Driver 8 III Programming the PulseBlaster 8 The PulseBlaster Interpreter 8 IV Connecting to the PulseBlaster Board 9 Connector Information 9 DB 25 and JP300 TTL Output Signa...

Page 4: ...PulseBlaster Appendix II Sample C Program 15 Contact Information 17 http www spincore com 5 19 2006 4...

Page 5: ...is that the execution time of instructions is user programmable This feature makes the PulseBlaster processor capable of executing complex patterns at greatly varying update rates ranging from nanose...

Page 6: ...to a 50 ns pulse delay update with a 100 MHz clock The external memory models up to 32k words have a nine clock period minimum instruction cycle Instruction set PulseBlaster s design features a set of...

Page 7: ...pulse interval for 32k memory words models at 100 MHz 2 years longest pulse interval 10 ns pulse interval resolution at 100 MHz 32k instructions max memory space 512 instructions for internal memory...

Page 8: ...ter The PulseBlaster Interpreter The PulseBlaster board is now programmable via the PulseBlaster Interpreter which is a free programming utility provided by SpinCore for writing pulse programs This ea...

Page 9: ...is active pin 2 GND When a falling edge is detected e g when shorting pins 1 2 it initiates code execution This trigger will also restart execution of a program from the beginning of the code if it i...

Page 10: ...elf control by one of the fields of the instruction word the shortest being five clock cycles for 512 memory word models and the longest being 2 52 clock cycles All instructions have the same format a...

Page 11: ...tion 0 CONTINUE Ignored Program execution continues to next instruction 1 STOP Ignored Stop execution of program Note all TTL values remain from previous instruction and analog outputs turn off 2 LOOP...

Page 12: ...and facilitate the construction of pulse program instructions IIn order to use these functions the DLL spinapi dll the library file libspinapi a for mingw spinapilibgcc for borland and spinapi lib fo...

Page 13: ...to be executed Please see Table 2 for details int inst_data data to be used with the previous inst field Please see Table 2 for details int length duration of this pulse program instruction specified...

Page 14: ...rt_programming PULSE_PROGRAM Instruction 0 Continue to instruction 1 in 100ms Flags 0xFFFFFF OPCODE CONTINUE start pb_inst 0xFFFFFF CONTINUE 0 200 0 ms Instruction 1 Continue to instruction 2 in 100ms...

Page 15: ...by hand Instructions start at 0 and count up sub 5 Instruction format int pb_inst int flags int inst int inst_data int length Instruction 0 Jump to Subroutine at Instruction 4 in 1s start pb_inst 0xF...

Page 16: ...om Subroutine to Instruction 1 in 5 s pb_inst 0xF0F0F0 RTS 0 500 0 ms End of pulse program pb_stop_programming Trigger the pulse program pb_start Read the status register status pb_read_status printf...

Page 17: ...PulseBlaster Contact Information Email sales spincore com Web http www spincore com Product URL http www pulseblaster com CD PulseBlaster PCI SP2 http www spincore com 5 19 2006 17...

Reviews: