View Full Version : Sample Program
Is there a sample StatiC program that will run on the MiniPod?
Thanks,
Jordon
petegray
11-21-04, 11:36 AM
Hi Jordan,
Yes, both of the FSM-mode example programs from the bundle -
http://petegray.newmicros.com/staticdspdemo.zip
- work "out-of-the-box" with the MiniPod.
The non-FSM example requires a little modification due to the fact that the LEDs are on different ports / lines, compared to the other NMI boards ...
// dspled2.nsm
//
// Non-FSM demo for MiniPod (DSP56F803)
//
// Activates LEDs based on user keyboard input (via SCI)
//
// Build Instructions:
/*
staticdsp dspled2.nsm -a568
a568 vec805.asm clist.asm
flash
*/
// port E definitions for GPIO (LEDs)
#define PEPUR $0FF0
#define PEDR $0FF1
#define PEDDR $0FF2
#define PEPER $0FF3
#define PEIAR $0FF4
#define PEIENR $0FF5
#define PEIPOLR $0FF6
#define PEIPR $0FF7
#define PEIESR $0FF8
// SCI0 definitions for terminal (RS232) interface
#define SCI0BR $0F00
#define SCI0CR $0F01
#define SCI0SR $0F02
#define SCI0DR $0F03
// constants - the welcome message
const msg1 "LEDs on/off 1/2=Green 3/4=Red."
const msge 13,10,0
// output a null-terminated string to SCI0
procedure sci0output (optr)
begin
word ostat 1
while ^optr
ostat = ^SCI0SR
while ( ostat & $C000 ) <> $C000
ostat = ^SCI0SR
endwhile
^SCI0DR = ^optr
optr = optr + 1
endwhile
end
// read a character from SCI0
procedure sci0input (rchar)
begin
word ostat 1
ostat = ^SCI0SR
while ( ostat & $3000 ) <> $3000
ostat = ^SCI0SR
endwhile
^rchar = ^SCI0DR
end
program
begin
word ichar 1
^SCI0BR = 260 // baud 9600
^SCI0CR = 12 // 8N1
^PEIAR = 0 // enable LEDs
^PEIENR = 0
^PEIPOLR = 0
^PEIESR = 0
^PEPER = $00F3
^PEDDR = $000C
^PEPUR = $00FF
call sci0output (@msg1) // display message
^PEDR = 0 // LEDs off
while 1 // loop forever
call sci0input (@ichar)
if ( ichar = '1' ) ^PEDR = ^PEDR | $0008 endif
if ( ichar = '2' ) ^PEDR = ^PEDR & $00F7 endif
if ( ichar = '3' ) ^PEDR = ^PEDR | $0004 endif
if ( ichar = '4' ) ^PEDR = ^PEDR & $00FB endif
endwhile
end
Regards,
-Pete.
p.s. if the above didn't cut-and-paste properly, email me and I'll send you it.
Pete;
Thanks for your reply. Thanks as well for your article in DDJ 10/24.
I need some help with TankBot:
1) What are the approptiate connectors for the SRF04?
2) Can you suggest a vendor for the connectors as well as the
4-AA battery pack?
3) I am unable to locate the code to run TankBot.
Thanks for your help,
Jordon
petegray
11-22-04, 07:14 PM
Jordan, no problem. Hope you enjoyed the article.
The physical header connector for the SRF04 I bought from JDR Microdevices, item HDR-40 (1x40 snap-able pin header strip). I used the cut-able female connectors from NMI's cable kit to attach to the headers.
I think I used a couple of 'spare' battery packs, but you can pick them up from just about anywhere. I think I originally bought mine at Radio Shack.
DDJ printed 'snippets' of the Tankbot code in the article. Email me (petegray@ieee.org) and I'll send you the whole thing.
Regards,
-Pete.
p.s. You'll get stung for shipping and handling if all you buy is HDR-40, so you're better off waiting until you have a need to purchase multiple items - or buy the same header strip from your 'usual' distributor, the next time you place a multi-item order.
vBulletin v3.0.7, Copyright ©2000-2012, Jelsoft Enterprises Ltd.