[chbot] The next steps for my bot and control board.

Michael Pearce chchrobotics@lists.linuxnut.co.nz
Sat, 30 Sep 2006 00:02:53 +1200


--Boundary-00=_utQHF9m4/ahiwYB
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


Just tested the code on a scope - It looks to work - need to 
test on a Servo when they arrive.

Test program code and hex file attached.


Mike


-- 
KIWACAN 
Electronics Design
Concept to Production

Mobile:  +64-21-249-5674
Phone:   +64-3-347-3311
Fax:     +64-3-347-2123
Website: http://www.kiwacan.co.nz


--Boundary-00=_utQHF9m4/ahiwYB
Content-Type: text/x-hex;
  charset="iso-8859-1";
  name="RCPulse.hex"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="RCPulse.hex"

:020000040000fa
:080000000001040000000000f3
:020000040000fa
:100200002f80200080bf2000000188000000000037
:10021000050007000c0007001c020200000000009f
:100220000040da000000fe004440a9000000200069
:100230000000e0000300320000002000a001880060
:100240004440a80000000600a02920000100200072
:100250001600370062004000e080480091018800ed
:100260009001ba0062004000e080480091018800df
:100270009002ba0062004000e08048000002eb00fb
:100280006028e10005003a008301e900070033001f
:10029000038009000059eb00040037006128e100e9
:1002a000010032000082eb00050007009101880088
:1002b0001001ba000200e000e6ff3a00000005006d
:1002c000910188008002780062004000e0804800d0
:1002d0003559ba008301e900080032002559ba00f7
:1002e0008301e900050032000400e000f4ff320061
:1002f00015d9ba008301e900f1ff3a0000000600b9
:100300000000fa000000eb0020088800ca02a900e3
:10031000c602a9005109200091407800f0c8b3003e
:1003200000c0600001c4b3000140700095e0b70058
:100330008460a9008c60a8001000200000408800a4
:100340000080fa00000006000600fa00000f7800a6
:100350000008e20003003a000000eb0020079800cc
:1003600015003700f00f20009e0f1000020036002d
:10037000f00f2000000f78009e007800500720004a
:100380000008b800b248270002004000100798009b
:100390000000eb00000888001e0090001008880094
:1003a000ca02a80005e1a8000000eb000040880098
:1003b00012002000220798002e0090000080fa0012
:1003c000000006000000fa00004080000080fa00f3
:1003d0000000060000a0fe000000fa00ca02a9000a
:1003e00005e1a9008460a9001000200000408800f9
:1003f0000080fa000080fe00004006000400fa00c1
:10040000000f78001e00e0000900340020a923003e
:10041000100798001e0090000000e90010079800e7
:100420000000e000fbff3a001e0fe900f5ff370077
:100430000080fa00000006000200fa000080eb00d5
:1004400040158800aeff07000000eb00000f7800a9
:10045000f00f20009e0f100009003e001e007800e3
:10046000b9ff0700d7ff07000000e000fdff3200e2
:1004700040012000e1ff07001e0fe800f4ff3700f5
:10048000803e2000ddff0700f00f2000000f780005
:100490001e00e0000a0032001e007800aaff0700dc
:1004a000c8ff07000000e000fdff3200400120000f
:1004b000d2ff07001e007800650f5000f4ff3700e0
:1004c000803e2000cdff07000000eb00000f780009
:1004d000f00720009e0f100013003e0001082000ce
:1004e0001e80400098ff0700b6ff07000000e000f4
:1004f000fdff320040062000c0ff0700000820007a
:100500001e00500090ff0700aeff07000000e00053
:10051000fdff320040062000b8ff07001e007800f3
:10052000680f4000eaff3700803e2000b3ff07005d
:04053000c5ff3700cc
:020000040000fa
:10000800a2020000a2020000a2020000a202000058
:10001800a2020000a2020000a2020000a202000048
:10002800a2020000a2020000a2020000ea010000f1
:10003800a2020000a2020000a2020000a202000028
:10004800a2020000a2020000a2020000a202000018
:10005800a2020000a2020000a2020000a202000008
:10006800a2020000a2020000a2020000a2020000f8
:10007800a2020000a2020000a2020000a2020000e8
:10008800a2020000a2020000a2020000a2020000d8
:10009800a2020000a2020000a2020000a2020000c8
:1000a800a2020000a2020000a2020000a2020000b8
:1000b800a2020000a2020000a2020000a2020000a8
:1000c800a2020000a2020000a2020000a202000098
:1000d800a2020000a2020000a2020000a202000088
:1000e800a2020000a2020000a2020000a202000078
:0800f800a2020000a2020000b8
:020000040000fa
:10010800a2020000a2020000a2020000a202000057
:10011800a2020000a2020000a2020000a202000047
:10012800a2020000a2020000a2020000ea010000f0
:10013800a2020000a2020000a2020000a202000027
:10014800a2020000a2020000a2020000a202000017
:10015800a2020000a2020000a2020000a202000007
:10016800a2020000a2020000a2020000a2020000f7
:10017800a2020000a2020000a2020000a2020000e7
:10018800a2020000a2020000a2020000a2020000d7
:10019800a2020000a2020000a2020000a2020000c7
:1001a800a2020000a2020000a2020000a2020000b7
:1001b800a2020000a2020000a2020000a2020000a7
:1001c800a2020000a2020000a2020000a202000097
:1001d800a2020000a2020000a2020000a202000087
:1001e800a2020000a2020000a2020000a202000077
:0801f800a2020000a2020000b7
:020000040000fa
:1005340000080000020000000000000000000000ad
:020000040000fa
:040544000000fe00b5
:00000001FF

--Boundary-00=_utQHF9m4/ahiwYB
Content-Type: text/x-csrc;
  charset="iso-8859-1";
  name="rctest.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="rctest.c"

/***************************
* rctest.c
*
* Test code for RCPulse code
****************************/
#include <p30fxxxx.h>
#include "rcpulse.h"

_FOSC(CSW_FSCM_OFF & FRC & FRC_PLL16); /* Internal Osc PLLx16 = 30MIP */
_FWDT(WDT_OFF);                        /* Watchdog Off */
_FBORPOR(PBOR_OFF & MCLR_EN);          /* Brownout Disabled - MCLR Enabled */
_FGS(CODE_PROT_OFF);                   /* Code Protect OFF */

void DelayMs(int dly)
{
 unsigned int x;

 while(dly >0)
 {
  x=14994;  /* at 30 mips 30000 cycles per ms /2 minus a few for setup */
  while(--x)continue;  
  dly--;
 }
}

int main(void)
{
 unsigned int pos;
  
 ADPCFG=0xFFFF; /* All to Digital pins! */
 
 RCPulse_Init();
 
 while(1)
 {
  for(pos=0;pos<256;pos++)
  {
   RCPulse(pos);
   while(RCDone()==0);
   DelayMs(20);   /* 20mS delay min between pulses */
  }

  DelayMs(1000);
  

  for(pos=255;pos>0;pos-=5)
  {
   RCPulse(pos);
   while(RCDone()==0);
   DelayMs(20);   /* 20mS delay min between pulses */
  }

  DelayMs(1000);

  /* Bounce between extreams and eventually end up in the middle*/
  for(pos=0;pos<128;pos+=8)
  {
   RCPulse(pos+128);
   while(RCDone()==0);
   DelayMs(100);  

   RCPulse(128-pos);
   while(RCDone()==0);
   DelayMs(100);  
  }

  DelayMs(1000);
 }
  
 return(0);	
}

--Boundary-00=_utQHF9m4/ahiwYB--