Sunday, November 15, 2009

PIC18F2550 USB HID Mouse

As my first step in learning on how to interface on PC USB ports, I copied the example source code for usb hid mouse by CCS C compiler. It's just a simple demo, moving the mouse pointer into a circular pattern, but it already gave me enough confidence because this example code works on my simple circuit. Since there's no problem with the circuit, I've continued with the next step which is the familiarization with the code routines/functions by modifying them (i.e. experimenting with the example code).

CCS C uses the usb_put_packet() command to send one packet to the usb host(PC), e.g. usb_put_packet(1, out_data, 4, USB_DTS_TOGGLE). The out_data parameter is an array of 4 elements (i.e. int8 out_data[4]). The first byte of out_data correspond to the state of mouse buttons, the second and third are for the x and y directions, while the last byte is for mouse wheel.

After experimenting with the usb_put_packet() function, I came up with this modified demo code for usb hib mouse. Instead of only moving the mouse pointer, I've configured it to 'draw some lines' on Microsoft Paint. And this was the result:
video

Here's the code used in that demo video:
 // USB HID Mouse draws "usb pic18F2550" on MS Paint
#include <18F2550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#use delay(clock=48000000)

#define USB_HID_DEVICE TRUE
#define USB_EP1_TX_ENABLE USB_ENABLE_INTERRUPT
#define USB_EP1_TX_SIZE 8
#include <pic18_usb.h>
#include <usb_desc_mouse.h>
#include <usb.c>

#define delay 20
#define scale 17
void draw_vertical(int8 direction)
{
int8 data[4], count = 0;
data[0] = 1;
data[1] = 0;
data[2] = direction;
data[3] = 0;
while(count<scale){
 if(usb_put_packet(1, data,4,USB_DTS_TOGGLE)) count++;
 delay_ms(delay);
}
}
void draw_horizontal(int8 direction)
{
int8 data[4], count = 0;
data[0] = 1;
data[1] = direction;
data[2] = 0;
data[3] = 0;
while(count<scale){
 if(usb_put_packet(1, data,4,USB_DTS_TOGGLE)) count++;
 delay_ms(delay);
}
}
void move_pointer(int8 x_direction, int8 y_direction)
{
int8 data[4], count = 0;
data[0] = 0;
data[1] = x_direction;
data[2] = y_direction;
data[3] = 0;
while(count<scale){
 if(usb_put_packet(1, data,4,USB_DTS_TOGGLE)) count++;
 delay_ms(delay);
}
}
void main(void)
{
usb_init_cs();

while (TRUE) {
 usb_task();
 if (usb_enumerated())
 {
   // 'u'
   draw_vertical(5);
   draw_horizontal(4);
   draw_vertical(-5);
   // 's'
   move_pointer(1,5);
   draw_horizontal(5);
   draw_vertical(-3);
   draw_horizontal(-4);
   draw_vertical(-3);
   draw_horizontal(4);
   // 'b'
   move_pointer(2,-4);
   draw_vertical(8);
   draw_horizontal(4);
   draw_vertical(-5);
   draw_horizontal(-4);
   // 'p'
   move_pointer(7,4);
   draw_horizontal(4);
   draw_vertical(-3);
   draw_horizontal(-4);
   draw_vertical(6);
   // 'i'
   move_pointer(5,-3);
   draw_vertical(-4);
   // 'c'
   move_pointer(4,3);
   draw_horizontal(-3);
   draw_vertical(-3);
   draw_horizontal(3);
   // '1'
   move_pointer(2,-4);
   draw_vertical(6);
   // '8'
   move_pointer(2,-3);
   draw_vertical(-3);
   draw_horizontal(3);
   draw_vertical(3);
   draw_horizontal(-3);
   draw_vertical(3);
   draw_horizontal(3);
   draw_vertical(-3);
   // 'F'
   move_pointer(2,4);
   draw_vertical(-7);
   draw_horizontal(4);
   move_pointer(-1,3);
   draw_horizontal(-3);
   // '2'
   move_pointer(4,-1);
   draw_horizontal(3);
   draw_vertical(3);
   draw_horizontal(-3);
   draw_vertical(3);
   draw_horizontal(3);
   // '5'
   move_pointer(2,0);
   draw_horizontal(3);
   draw_vertical(-3);
   draw_horizontal(-3);
   draw_vertical(-3);
   draw_horizontal(3);
   // '5'
   move_pointer(5,0);
   draw_horizontal(-3);
   draw_vertical(3);
   draw_horizontal(3);
   draw_vertical(3);
   draw_horizontal(-3);
   // '0'
   move_pointer(5,0);
   draw_vertical(-5);
   draw_horizontal(3);
   draw_vertical(5);
   draw_horizontal(-3);
   // line
   move_pointer(0,7);
   draw_horizontal(-22);
   draw_vertical(2);
   draw_horizontal(22);
  
  
   delay_ms(5000);
 }
}
}

then the HEX file generated using CCS Microchip C PCH v4.088 compiler:
 :020000040000FA  
 :040000005EEF07F0B8  
 :08000800056ED8CF06F0E0CF31  
 :1000100007F00001E9CF0DF0EACF08F0E1CF09F0D9  
 :10002000E2CF0AF0D9CF0BF0DACF0CF0F3CF14F017  
 :10003000F4CF15F0FACF16F000C00FF001C010F0A9  
 :1000400002C011F003C012F004C013F0A0AA2CEFFC  
 :1000500000F0A1BA2EEF06F00FC000F010C001F0C2  
 :1000600011C002F012C003F013C004F00DC0E9FF8C  
 :1000700008C0EAFF088E09C0E1FF0AC0E2FF0BC01A  
 :10008000D9FF0CC0DAFF14C0F3FF15C0F4FF16C08F  
 :10009000FAFF055007C0E0FF06C0D8FF1000F76A5E  
 :1000A000AE0FF66E000EF7220900F55012000403A1  
 :1000B0000000000000000000000000000000F76ADF  
 :1000C000CE0FF66E000EF7220900F5501200040064  
 :1000D0000000000000000000000000000000F76ABF  
 :1000E000EE0FF66E000EF7220900F55012004000E8  
 :1000F00008000000000000000000000000000000F8  
 :100100000000000000000000000000000000F76A8E  
 :100110001E0FF66E010EF7220900F5501200400086  
 :1001200000000000000000000000000000000000CF  
 :100130000000000000000000000000000000F76A5E  
 :100140004E0FF66E010EF7220900F5501200050160  
 :100150000902A1010901A1000509190129031500DE  
 :100160002501950375018102950175058101050140  
 :100170000930093109381581257F750895038106F5  
 :10018000C0C0F76A920FF66E010EF7220900F55013  
 :1001900012000000F76AA40FF66E010EF7220900A4  
 :1001A000F55012003400F76AB60FF66E010EF72212  
 :1001B0000900F550120009022200010100C03209B5  
 :1001C00004000001030102000921000100012234A2  
 :1001D000000705810308000AF76AE80FF66E010EB2  
 :1001E000F7220900F55012000100F76AFA0FF66EC7  
 :1001F000010EF7220900F550120012011001000053  
 :10020000004061042200000101020001F76A1C0F96  
 :10021000F66E020EF7220900F550120000040C00E1  
 :10022000F76A300FF66E020EF7220900F550120041  
 :100230000403090408034300430053001C03430064  
 :1002400043005300200055005300420020004D00A1  
 :100250006F007500730065006D926994689439EFC2  
 :1002600006F06A6A689242EF06F03E6A3E520AE180  
 :10027000036A3E50240FE96E000E0320EA6EEF6A17  
 :100280003E2AF4D71A6A010E1B6E196A000C010E81  
 :10029000476E47500F080EE3700E4724016E0F0E95  
 :1002A000036ED8B0032A01C0E9FF03C0EAFFEF6A7A  
 :1002B000472AEFD71E6A1D6A000C400E0401016F29  
 :1002C000050E036F026B880E006F046B050E076F3F  
 :1002D000400E066F0001000C6A6A686A9F0E6B6E22  
 :1002E000390E696E6E6AC1DFD2DF160E706E68A6B7  
 :1002F00002D06896FCD76D98E0DF030E1F6E48EFC2  
 :1003000006F0698468986D824EEF06F0689C54EFA1  
 :1003100006F070A002D0D1DF7090689A5AEF06F014  
 :1003200042C020F0000CFF0E206E000C406A2352E9  
 :100330003EE040503F083BE31C50FC0F2BE2040F13  
 :10034000E1EF01F0036A2250F2CF42F0F29E2BDF80  
 :1003500042BEF28E416E1ED0036A2250F2CF42F0AE  
 :10036000F29EEDDE42BEF28E416E14D0036A225040  
 :10037000F2CF42F0F29E54DF42BEF28E416E0AD0BE  
 :10038000036A2250F2CF42F0F29E2FDF42BEF28E7D  
 :10039000416E00D0222A23064050402A036A400FB3  
 :1003A000E96E050E0320EA6E41C0EFFFC0D723526D  
 :1003B00004E14050400801E0196A40C042F0B0DF5B  
 :1003C000000CE824F76AF736DD0FF66E030EF7220D  
 :1003D0000A00F550FA6E0800F550F96E4403580310  
 :1003E0006C038003226A1C6A05010351010A0001A3  
 :1003F00009E0030A0CE0010A0DE0220A22E0030AE8  
 :1004000032E058D0120E236E030E1C6E55D0220E11  
 :10041000236E52D0020E1C6E036A05010251F2CF08  
 :1004200040F0F29E0001F2DE40BEF28E226E036AC0  
 :100430002250F2CF40F0F29EF3DE40BEF28E236EE9  
 :100440003BD0120E226E223C01D00BD0036A225008  
 :10045000F2CF40F0F29EA7DE40BEF28E236E2CD08B  
 :1004600002D061DF35D0D89005010435036AF2CFA0  
 :1004700040F0F29E000185DE0900F5CF03F040BE9A  
 :10048000F28E226E223C01D013D0010E1C6ED89049  
 :1004900005010435036AF2CF40F0F29E00017ADED6  
 :1004A0000900F5CF03F040BEF28E236E05D002D0D6  
 :1004B0003ADF0ED038DF0CD00501075305E1235099  
 :1004C000065D02E206C523F0010E196E00012EDF63  
 :1004D000000C3F5204E1040E1F6ED9DEC1D0050EA0  
 :1004E0001F6E426E800E416E010E406E40500F082E  
 :1004F000D8A0B6D0436A036A4050F2CF47F0F29ECC  
 :10050000DEDD47BEF28E000A51E0040E436ED89045  
 :100510004034036AF2CF47F0F29EF9DD0900F5CFCF  
 :1005200003F047BEF28E446E03C045F04050080D04  
 :10053000F350010F016E040E036ED8B0032A01C000  
 :10054000E9FF03C0EAFF44C0EFFF4050080DF3503D  
 :10055000020F016E040E036ED8B0032A01C0E9FF3A  
 :1005600003C0EAFF42C0ECFFED5241C0EFFFD8905C  
 :100570004034036AF2CF47F0F29EC9DD0900F5CF9F  
 :1005800003F047BEF28E412603504222880E466E8B  
 :1005900045B0468045B246824050080DF3CF01F089  
 :1005A000040E01C0E9FFEA6E46C0EFFF036A405047  
 :1005B000F2CF47F0F29E73DD47BEF28E000A31E0C3  
 :1005C00043824050080DF350060F016E040E036E77  
 :1005D000D8B0032A01C0E9FF03C0EAFF42C0ECFF24  
 :1005E000ED5241C0EFFFD8904034036AF2CF47F09C  
 :1005F000F29E75DD0900F5CF03F047BEF28E41266D  
 :10060000035042224050080DF350040F016E040EB7  
 :10061000036ED8B0032A01C0E9FF03C0EAFF400E11  
 :10062000EF6E4350060802E10E0E436E036A40501F  
 :10063000F2CF47F0F29E33DD47BEF28E020801E0B2  
 :100640004388700E4024016E0F0E036ED8B0032A4B  
 :1006500001C0E9FF03C0EAFF43C0EFFF402A46D7CD  
 :100660007CEF03F00501015100010DE0010A14E0E7  
 :10067000020A1EE0060A27E0030A2CE00E0A2CE01C  
 :10068000010A30E03DD01BC040F50501416B020E70  
 :10069000426E000145DE36D00501022D06D0010E66  
 :1006A0001B16426A00013CDE02D000013CDE2AD06B  
 :1006B0000501022D05D01B82426A000131DE02D005  
 :1006C000000131DE1FD0020E196E02C521F0426A10  
 :1006D00027DE18D087DE16D01AC040F5010E426E14  
 :1006E0001FDE10D005010251010808E302C51AF00F  
 :1006F00002C53FF00001EDD6426A12DE000102D0D1  
 :1007000012DE00D0B2EF04F01AC03FF00501015133  
 :10071000000107E00A0A0DE0010A2DE00D0A3DE0A4  
 :100720003ED00501406B416B020E426E0001F8DDC8  
 :1007300038D03F521EE0010E3F5C036AF2CF40F01A  
 :10074000F29E4ADD40BEF28E016E0501045DD8A026  
 :1007500002D000010ED0036A0451240FE96E000E8E  
 :100760000320EA6EEFCF40F5010E426E0001D8DDA6  
 :1007700001D0D9DD16D03F520EE0036A05010451C5  
 :10078000240FE96E000E0320EA6E02C5EFFF426AF5  
 :100790000001C6DD01D0C7DD04D024DE02D0C3DDF8  
 :1007A00000D0B2EF04F040903FBE40803F9E40A09A  
 :1007B00010D0036A3F50F2CF41F0F29E70DC41BE90  
 :1007C000F28E000A02E1000E01D0010E016E10D07F  
 :1007D0000FD0036A3F50F2CF41F0F29E70DC41BE71  
 :1007E000F28E000A02E1000E01D0010E016E00D06F  
 :1007F0006AEF04F040903FBE40803F9E40A010D082  
 :100800003F50080DF350040F016E040E036ED8B074  
 :10081000032A01C0E9FF03C0EAFF880EEF6E09D08A  
 :100820003F50080DF3CF01F0040E01C0E9FFEA6E5E  
 :10083000EF6A79EF04F040903FBE40803F9E40A0B9  
 :1008400010D03F50080DF350040F016E040E036EDC  
 :10085000D8B0032A01C0E9FF03C0EAFF840EEF6E9F  
 :100860000AD03F50080DF3CF01F0040E01C0E9FF9C  
 :10087000EA6E840EEF6E7FEF04F040903FBE408042  
 :100880003F9E40A010D03F50080DF350040F016E62  
 :10089000040E036ED8B0032A01C0E9FF03C0EAFFCB  
 :1008A000EFCF41F00AD03F50080DF3CF01F0040E16  
 :1008B00001C0E9FFEA6EEFCF41F041AE02D041B492  
 :1008C00002D0000E01D0010E016E89EF04F004C5C4  
 :1008D0003FF069D7015229E005010151010A0001E9  
 :1008E00005E0020A09E0030A0DE01DD004C53FF04F  
 :1008F00081D7426A15DD19D004C53FF09CD7426A02  
 :100900000FDD13D00501406B416B04C53FF00001C2  
 :10091000B4D7015204E0010E0501406F0001020E40  
 :10092000426EFEDC02D0FFDC00D0B2EF04F0050125  
 :10093000015100D00001F7DC00D0B2EF04F0196AD9  
 :10094000050100517F0B000107E0010A06E0030AE0  
 :1009500005E0230A04E004D085D6D6D6B8D7E7D779  
 :10096000E2DC00D0D9EF05F03F50080DF3CF01F0E5  
 :10097000040E01C0E9FFEA6EEFCF41F040500208DB  
 :1009800006E141AC02D0406A02D0010E406E4050F8  
 :10099000030812E1840E416E3F50080DF350040F1E  
 :1009A000016E040E036ED8B0032A01C0E9FF03C034  
 :1009B000EAFF840EEF6E09D0402C03D0C80E416EC2  
 :1009C00004D0405202E1880E416E036A010E026EAD  
 :1009D0003F50006E05E0D89002360336002EFBD75C  
 :1009E0000250FF0A006EFF0E031A00501D1603503E  
 :1009F0001E16D8903F34036AF2CF44F0F29E87EC83  
 :100A000000F00900F5CF03F044BEF28E426E03C041  
 :100A100043F03F50080DF350010F016E040E036EBA  
 :100A2000D8B0032A01C0E9FF03C0EAFF42C0EFFFCC  
 :100A300043B0418043B241823F50080DF3CF01F0F3  
 :100A4000040E01C0E9FFEA6E41C0EFFF000C3F5009  
 :100A5000080DF350040F016E040E036ED8B0032A84  
 :100A600001C0E9FF03C0EAFFEFCF43F043BE5BD014  
 :100A70003F50080DF350050F016E040E036ED8B001  
 :100A8000032A01C0E9FF03C0EAFF40C0EFFF425064  
 :100A9000020816E13F50080DF350040F016E040EDA  
 :100AA000036ED8B0032A01C0E9FF03C0EAFFEFCF0D  
 :100AB00043F043AC02D0426A02D0010E426E13D022  
 :100AC0004250040810E13F50080DF3CF01F0040E2E  
 :100AD00001C0E9FFEA6EEFCF43F043AC03D0010E53  
 :100AE000426E01D0426A422C03D0C80E436E04D03D  
 :100AF000425202E1880E436E41B0438041B24382CC  
 :100B00003F50080DF350040F016E040E036ED8B071  
 :100B1000032A01C0E9FF03C0EAFF43C0EFFF010E53  
 :100B2000016E03D000D0000E016E000C3F5203E1B5  
 :100B30005DEC01F00FD0036A010E026E3F50006EB3  
 :100B400005E0D89002360336002EFBD702501D1266  
 :100B500003501E12000C40C06EFF405203E0040E12  
 :100B60001F6E02D0020E1F6EBBEF05F01A6A196AE3  
 :100B700021C040F0F0D7C8EF05F03F5209E1192C31  
 :100B800003D096EC01F004D01950020801E1EED731  
 :100B9000000C6C303E6E3E323E321F0E3E166C52E2  
 :100BA0003BE1040100513C0B34081BE1046B0001E4  
 :100BB000C6D6203C05D03F6A030E406ED5DE0ED06F  
 :100BC0003F6A020E406ED0DE2050FE0807E03F6A0A  
 :100BD000416A20C040F0040E426E39DF6D9819D092  
 :100BE000040100513C0B040815E13F6A00019EDF3F  
 :100BF0003F6A020E406EB8DE2050FE080AE0203C3C  
 :100C000001D007D03F6A416A20C040F0010E426E19  
 :100C10001EDF040120D000016C50040812E1FF0E19  
 :100C2000206E3F6AAADF203C01D008D03F6A416AAB  
 :100C300020C040F0020E426E0ADF02D05DEC01F0EF  
 :100C400009D06CB404D03EC03FF070DF03D03EC08A  
 :100C50003FF093DF040100015FEF06F01F5201E156  
 :100C60002FD068522DE068A404D069A402D02CEFE4  
 :100C700001F06DA201D024D068A204D069A202D0F4  
 :100C800031EF01F068A004D069A002D06CEF01F050  
 :100C900068A804D069A802D081EF01F068AC04D044  
 :100CA00069AC02D086EF01F068AA04D069AA02D02C  
 :100CB00089EF01F068A604D069A602D06AD76896C9  
 :100CC000A19A2CEF00F06D6A696A080E6F6E94505D  
 :100CD0003009946E1F6A186AF2BE188EF29E35ECC7  
 :100CE00001F018BEF28E1E6A1D6A6CEF07F0186ADA  
 :100CF000F2BE188EF29E35EC01F018BEF28E6D6ACF  
 :100D0000140E6F6E696A6D86010E1F6E8BEF06F012  
 :100D10006DB601D0ECD71F2C0BD06DBA09D0686A24  
 :100D2000696AA08AC00EF212110E696E020E1F6E61  
 :100D30006DEF07F02C50080DF350040F016E040EF8  
 :100D4000036ED8B0032A01C0E9FF03C0EAFFEFCF6A  
 :100D500034F034BE45D02C50080DF350060F016E10  
 :100D6000040E036ED8B0032A01C0E9FF03C0EAFFF6  
 :100D7000ECCF03F0ED52EFCF35F003C036F0336A1D  
 :100D8000326A3350305C1AE303E12F50325C16E2D2  
 :100D90002DC0E9FF2EC0EAFFEFCF39F036C0EAFFE1  
 :100DA00035C0E9FF39C0EFFF352AD8B4362A2D2ADD  
 :100DB000D8B42E2A322AD8B4332AE3D7186AF2BE1E  
 :100DC000188EF29E2CC03FF030C041F02FC040F092  
 :100DD00031C042F03CDE18BEF28E015003D000D08C  
 :100DE000000E016E000CEA6A2C0EE96EEF500EE068  
 :100DF0000F0E016E006A002EFED7012EFBD78F0E5C  
 :100E0000006E002EFED70000EF2EF2D7000C2A6AEB  
 :100E1000010E266E276A25C028F0296A2A5010087C  
 :100E200012E3010E2C6E2E6A260E2D6E306A040E11  
 :100E30002F6E020E316E7EDF0152D8A42A2A140EC4  
 :100E40002C6ED1DFEBD7000C2A6A010E266E25C06E  
 :100E500027F0286A296A2A50100812E3010E2C6E26  
 :100E60002E6A260E2D6E306A040E2F6E020E316E23  
 :100E700061DF0152D8A42A2A140E2C6EB4DFEBD7FE  
 :100E8000000C2B6A276A25C028F026C029F02A6AA0  
 :100E90002B50100812E3010E2C6E2E6A270E2D6EB9  
 :100EA000306A040E2F6E020E316E44DF0152D8A458  
 :100EB0002B2A140E2C6E97DFEBD7000CF86AD09E0D  
 :100EC000088EEA6AE96AC150C00B0F09C16E070EAD  
 :100ED000B46E1F6A236AF7D61BD71A52D8B4E8D06B  
 :100EE000050E256E94DF040E256EAEDFFB0E256E1B  
 :100EF0008EDF010E256E050E266EC3DF050E256EF4  
 :100F0000A3DFFD0E256E83DFFC0E256E9DDFFD0E3B  
 :100F1000256E7DDF040E256E97DF020E256EFC0E1A  
 :100F2000266EAFDF080E256E72DF040E256E8CDF95  
 :100F3000FB0E256E6CDFFC0E256E86DF070E256E20  
 :100F4000040E266E9EDF040E256E7EDFFD0E256EDE  
 :100F50005EDFFC0E256E78DF060E256E58DF050E6F  
 :100F6000256EFD0E266E8DDFFC0E256E50DF040E05  
 :100F7000256E030E266E85DFFD0E256E65DFFD0EE8  
 :100F8000256E45DF030E256E5FDF020E256EFC0E1B  
 :100F9000266E77DF060E256E3ADF020E256EFD0EF9  
 :100FA000266E6FDFFD0E256E32DF030E256E4CDFE1  
 :100FB000030E256E2CDFFD0E256E46DF030E256E1B  
 :100FC00026DF030E256E40DFFD0E256E20DF020EAC  
 :100FD000256E040E266E55DFF90E256E18DF040E01  
 :100FE000256E32DFFF0E256E030E266E4ADFFD0EE4  
 :100FF000256E2ADF040E256EFF0E266E42DF030EDD  
 :10100000256E22DF030E256E02DFFD0E256E1CDF2E  
 :10101000030E256EFCDE030E256E16DF020E256E16  
 :10102000266A2FDF030E256E0FDFFD0E256EEFDE25  
 :10103000FD0E256E09DFFD0E256EE9DE030E256E21  
 :1010400003DF050E256E266A1CDFFD0E256EFCDE15  
 :10105000030E256EDCDE030E256EF6DE030E256E16  
 :10106000D6DEFD0E256EF0DE050E256E266A09DF42  
 :10107000FB0E256ECCDE030E256EE6DE050E256E1C  
 :10108000C6DEFD0E256EE0DE256A070E266EF9DE51  
 :10109000EA0E256ED9DE020E256EB9DE160E256E1D  
 :1010A000D3DE140E256EFA0E2C6E9DDE252EFBD798  
 :0410B00013D703004F  
 :020000040030CA  
 :0E000000240E3E1E008381000FC00FE00F4053  
 :00000001FF  
 ;PIC18F2550  
 ;CRC=1458 CREATED="15-Nov-09 13:45"  


Also, the first hex code that worked on my circuit
(mouse pointer in circular movement):
 :020000040000FA
:040000001EEF07F0F8
:08000800056ED8CF06F0E0CF31
:1000100007F00001E9CF0DF0EACF08F0E1CF09F0D9
:10002000E2CF0AF0D9CF0BF0DACF0CF0F3CF14F017
:10003000F4CF15F0FACF16F000C00FF001C010F0A9
:1000400002C011F003C012F004C013F0A0AA2CEFFC
:1000500000F0A1BA43EF06F00FC000F010C001F0AD
:1000600011C002F012C003F013C004F00DC0E9FF8C
:1000700008C0EAFF088E09C0E1FF0AC0E2FF0BC01A
:10008000D9FF0CC0DAFF14C0F3FF15C0F4FF16C08F
:10009000FAFF055007C0E0FF06C0D8FF1000F76A5E
:1000A000AE0FF66E000EF7220900F55012000403A1
:1000B0000000000000000000000000000000F76ADF
:1000C000CE0FF66E000EF7220900F5501200040064
:1000D0000000000000000000000000000000F76ABF
:1000E000EE0FF66E000EF7220900F55012004000E8
:1000F00008000000000000000000000000000000F8
:100100000000000000000000000000000000F76A8E
:100110001E0FF66E010EF7220900F5501200400086
:1001200000000000000000000000000000000000CF
:100130000000000000000000000000000000F76A5E
:100140004E0FF66E010EF7220900F5501200050160
:100150000902A1010901A1000509190129031500DE
:100160002501950375018102950175058101050140
:100170000930093109381581257F750895038106F5
:10018000C0C0F76A920FF66E010EF7220900F55013
:1001900012000000F76AA40FF66E010EF7220900A4
:1001A000F55012003400F76AB60FF66E010EF72212
:1001B0000900F550120009022200010100C03209B5
:1001C00004000001030102000921000100012234A2
:1001D000000705810308000AF76AE80FF66E010EB2
:1001E000F7220900F55012000100F76AFA0FF66EC7
:1001F000010EF7220900F550120012011001000053
:10020000004061042200000101020001F76A1C0F96
:10021000F66E020EF7220900F550120000040C00E1
:10022000F76A300FF66E020EF7220900F550120041
:100230000403090408034300430053001C03430064
:1002400043005300200055005300420020004D00A1
:100250006F00750073006500F2CF0EF0F29EF76A32
:10026000720FF66E020EF7220900F5500EBEF28EE6
:100270001200000103040404030100FFFDFCFCFC68
:10028000FDFF6D92699468944EEF06F06A6A689279
:1002900057EF06F03E6A3E520AE1036A3E50240FD1
:1002A000E96E000E0320EA6EEF6A3E2AF4D71A6A5E
:1002B000010E1B6E196A000C010E476E47500F08A5
:1002C0000EE3700E4724016E0F0E036ED8B0032AA2
:1002D00001C0E9FF03C0EAFFEF6A472AEFD71E6AB1
:1002E0001D6A000C400E0401016F050E036F026BC6
:1002F000880E006F046B050E076F400E066F00013D
:10030000000C6A6A686A9F0E6B6E390E696E6E6ABF
:10031000C1DFD2DF160E706E68A602D06896FCD7D9
:100320006D98E0DF030E1F6E5DEF06F0698468983C
:100330006D8263EF06F0689C69EF06F070A002D052
:10034000D1DF7090689A6FEF06F042C020F0000C89
:10035000FF0E206E000C406A23523EE040503F08E2
:100360003BE31C50FC0F2BE2040FF6EF01F0036A95
:100370002250F2CF42F0F29E16DF42BEF28E416E64
:100380001ED0036A2250F2CF42F0F29ED8DE42BE67
:10039000F28E416E14D0036A2250F2CF42F0F29EE8
:1003A0003FDF42BEF28E416E0AD0036A2250F2CF86
:1003B00042F0F29E1ADF42BEF28E416E00D0222A37
:1003C00023064050402A036A400FE96E050E0320C1
:1003D000EA6E41C0EFFFC0D7235204E1405040080D
:1003E00001E0196A40C042F0B0DF000CE824F76A6F
:1003F000F736070FF66E040EF7220A00F550FA6E74
:100400000800F550F96E6E0382039603AA03226A70
:100410001C6A05010351010A000109E0030A0CE00E
:10042000010A0DE0220A22E0030A32E058D0120E3F
:10043000236E030E1C6E55D0220E236E52D0020E78
:100440001C6E036A05010251F2CF40F0F29E0001DA
:10045000DDDE40BEF28E226E036A2250F2CF40F003
:10046000F29EDEDE40BEF28E236E3BD0120E226E76
:10047000223C01D00BD0036A2250F2CF40F0F29E12
:1004800092DE40BEF28E236E2CD002D061DF35D0DA
:10049000D89005010435036AF2CF40F0F29E0001C6
:1004A00070DE0900F5CF03F040BEF28E226E223CD2
:1004B00001D013D0010E1C6ED89005010435036ADB
:1004C000F2CF40F0F29E000165DE0900F5CF03F0A7
:1004D00040BEF28E236E05D002D03ADF0ED038DF58
:1004E0000CD00501075305E12350065D02E206C565
:1004F00023F0010E196E00012EDF000C3F5204E1C3
:10050000040E1F6ED9DEC1D0050E1F6E426E800E26
:10051000416E010E406E40500F08D8A0B6D0436A1D
:10052000036A4050F2CF47F0F29EC9DD47BEF28E1B
:10053000000A51E0040E436ED8904034036AF2CFB3
:1005400047F0F29EE4DD0900F5CF03F047BEF28EDE
:10055000446E03C045F04050080DF350010F016E8A
:10056000040E036ED8B0032A01C0E9FF03C0EAFFFE
:1005700044C0EFFF4050080DF350020F016E040E0F
:10058000036ED8B0032A01C0E9FF03C0EAFF42C0EE
:10059000ECFFED5241C0EFFFD8904034036AF2CF38
:1005A00047F0F29EB4DD0900F5CF03F047BEF28EAE
:1005B000412603504222880E466E45B0468045B221
:1005C00046824050080DF3CF01F0040E01C0E9FF50
:1005D000EA6E46C0EFFF036A4050F2CF47F0F29E4A
:1005E0005EDD47BEF28E000A31E043824050080DC6
:1005F000F350060F016E040E036ED8B0032A01C03B
:10060000E9FF03C0EAFF42C0ECFFED5241C0EFFF3B
:10061000D8904034036AF2CF47F0F29E60DD0900C3
:10062000F5CF03F047BEF28E4126035042224050E0
:10063000080DF350040F016E040E036ED8B0032AA8
:1006400001C0E9FF03C0EAFF400EEF6E4350060809
:1006500002E10E0E436E036A4050F2CF47F0F29E65
:100660001EDD47BEF28E020801E04388700E402472
:10067000016E0F0E036ED8B0032A01C0E9FF03C05C
:10068000EAFF43C0EFFF402A46D791EF03F0050190
:10069000015100010DE0010A14E0020A1EE0060A01
:1006A00027E0030A2CE00E0A2CE0010A30E03DD0DE
:1006B0001BC040F50501416B020E426E000145DE94
:1006C00036D00501022D06D0010E1B16426A00012C
:1006D0003CDE02D000013CDE2AD00501022D05D00F
:1006E0001B82426A000131DE02D0000131DE1FD0E0
:1006F000020E196E02C521F0426A27DE18D087DE8D
:1007000016D01AC040F5010E426E1FDE10D0050152
:100710000251010808E302C51AF002C53FF00001CA
:10072000EDD6426A12DE000102D012DE00D0C7EF21
:1007300004F01AC03FF005010151000107E00A0A68
:100740000DE0010A2DE00D0A3DE03ED00501406BB1
:10075000416B020E426E0001F8DD38D03F521EE0C0
:10076000010E3F5C036AF2CF40F0F29E35DD40BEE1
:10077000F28E016E0501045DD8A002D000010ED0FA
:10078000036A0451240FE96E000E0320EA6EEFCFD6
:1007900040F5010E426E0001D8DD01D0D9DD16D042
:1007A0003F520EE0036A05010451240FE96E000E6A
:1007B0000320EA6E02C5EFFF426A0001C6DD01D0E8
:1007C000C7DD04D024DE02D0C3DD00D0C7EF04F0C3
:1007D00040903FBE40803F9E40A010D0036A3F50F3
:1007E000F2CF41F0F29E5BDC41BEF28E000A02E1E4
:1007F000000E01D0010E016E10D00FD0036A3F50E1
:10080000F2CF41F0F29E5BDC41BEF28E000A02E1C3
:10081000000E01D0010E016E00D07FEF04F0409079
:100820003FBE40803F9E40A010D03F50080DF35087
:10083000040F016E040E036ED8B0032A01C0E9FF55
:1008400003C0EAFF880EEF6E09D03F50080DF3CFCA
:1008500001F0040E01C0E9FFEA6EEF6A8EEF04F0CA
:1008600040903FBE40803F9E40A010D03F50080DBA
:10087000F350040F016E040E036ED8B0032A01C0BA
:10088000E9FF03C0EAFF840EEF6E0AD03F50080D67
:10089000F3CF01F0040E01C0E9FFEA6E840EEF6EA3
:1008A00094EF04F040903FBE40803F9E40A010D0A7
:1008B0003F50080DF350040F016E040E036ED8B0C4
:1008C000032A01C0E9FF03C0EAFFEFCF41F00AD0DD
:1008D0003F50080DF3CF01F0040E01C0E9FFEA6EAE
:1008E000EFCF41F041AE02D041B402D0000E01D0B2
:1008F000010E016E9EEF04F004C53FF069D701526E
:1009000029E005010151010A000105E0020A09E0A0
:10091000030A0DE01DD004C53FF081D7426A15DD02
:1009200019D004C53FF09CD7426A0FDD13D00501F2
:10093000406B416B04C53FF00001B4D7015204E0A5
:10094000010E0501406F0001020E426EFEDC02D076
:10095000FFDC00D0C7EF04F00501015100D0000119
:10096000F7DC00D0C7EF04F0196A050100517F0BD6
:10097000000107E0010A06E0030A05E0230A04E09B
:1009800004D085D6D6D6B8D7E7D7E2DC00D0EEEFD4
:1009900005F03F50080DF3CF01F0040E01C0E9FF50
:1009A000EA6EEFCF41F04050020806E141AC02D0C0
:1009B000406A02D0010E406E4050030812E1840EDE
:1009C000416E3F50080DF350040F016E040E036E8C
:1009D000D8B0032A01C0E9FF03C0EAFF840EEF6E1E
:1009E00009D0402C03D0C80E416E04D0405202E121
:1009F000880E416E036A010E026E3F50006E05E0E4
:100A0000D89002360336002EFBD70250FF0A006E44
:100A1000FF0E031A00501D1603501E16D8903F34C7
:100A2000036AF2CF44F0F29E87EC00F00900F5CFA4
:100A300003F044BEF28E426E03C043F03F50080DF7
:100A4000F350010F016E040E036ED8B0032A01C0EB
:100A5000E9FF03C0EAFF42C0EFFF43B0418043B269
:100A600041823F50080DF3CF01F0040E01C0E9FFB1
:100A7000EA6E41C0EFFF000C3F50080DF350040F29
:100A8000016E040E036ED8B0032A01C0E9FF03C053
:100A9000EAFFEFCF43F043BE5BD03F50080DF35069
:100AA000050F016E040E036ED8B0032A01C0E9FFE2
:100AB00003C0EAFF40C0EFFF4250020816E13F507A
:100AC000080DF350040F016E040E036ED8B0032A14
:100AD00001C0E9FF03C0EAFFEFCF43F043AC02D00F
:100AE000426A02D0010E426E13D04250040810E157
:100AF0003F50080DF3CF01F0040E01C0E9FFEA6E8C
:100B0000EFCF43F043AC03D0010E426E01D0426AF6
:100B1000422C03D0C80E436E04D0425202E1880E2C
:100B2000436E41B0438041B243823F50080DF350C1
:100B3000040F016E040E036ED8B0032A01C0E9FF52
:100B400003C0EAFF43C0EFFF010E016E03D000D0E7
:100B5000000E016E000C3F5203E172EC01F00FD069
:100B6000036A010E026E3F50006E05E0D890023617
:100B70000336002EFBD702501D1203501E12000C2C
:100B800040C06EFF405203E0040E1F6E02D0020E02
:100B90001F6ED0EF05F01A6A196A21C040F0F0D735
:100BA000DDEF05F03F5209E1192C03D0ABEC01F069
:100BB00004D01950020801E1EED7000C6C303E6EF3
:100BC0003E323E321F0E3E166C523BE10401005194
:100BD0003C0B34081BE1046B0001C6D6203C05D059
:100BE0003F6A030E406ED5DE0ED03F6A020E406EA5
:100BF000D0DE2050FE0807E03F6A416A20C040F086
:100C0000040E426E39DF6D9819D0040100513C0B7F
:100C1000040815E13F6A00019EDF3F6A020E406E44
:100C2000B8DE2050FE080AE0203C01D007D03F6A21
:100C3000416A20C040F0010E426E1EDF040120D048
:100C400000016C50040812E1FF0E206E3F6AAADF1B
:100C5000203C01D008D03F6A416A20C040F0020E1B
:100C6000426E0ADF02D072EC01F009D06CB404D0FD
:100C70003EC03FF070DF03D03EC03FF093DF040181
:100C8000000174EF06F01F5201E12FD068522DE0F1
:100C900068A404D069A402D041EF01F06DA201D094
:100CA00024D068A204D069A202D046EF01F068A067
:100CB00004D069A002D081EF01F068A804D069A82F
:100CC00002D096EF01F068AC04D069AC02D09BEF83
:100CD00001F068AA04D069AA02D09EEF01F068A6CC
:100CE00004D069A602D06AD76896A19A2CEF00F0CA
:100CF0006D6A696A080E6F6E94503009946E1F6AAF
:100D0000186AF2BE188EF29E4AEC01F018BEF28EFE
:100D10001E6A1D6A30EF07F0186AF2BE188EF29E46
:100D20004AEC01F018BEF28E6D6A140E6F6E696A9D
:100D30006D86010E1F6EA0EF06F06DB601D0ECD7E8
:100D40001F2C0BD06DBA09D0686A696AA08AC00EE0
:100D5000F212110E696E020E1F6E31EF07F02C5069
:100D6000080DF350040F016E040E036ED8B0032A71
:100D700001C0E9FF03C0EAFFEFCF34F034BE45D035
:100D80002C50080DF350060F016E040E036ED8B000
:100D9000032A01C0E9FF03C0EAFFECCF03F0ED52E4
:100DA000EFCF35F003C036F0336A326A3350305C2F
:100DB0001AE303E12F50325C16E22DC0E9FF2EC08A
:100DC000EAFFEFCF39F036C0EAFF35C0E9FF39C09E
:100DD000EFFF352AD8B4362A2D2AD8B42E2A322A43
:100DE000D8B4332AE3D7186AF2BE188EF29E2CC00C
:100DF0003FF030C041F02FC040F031C042F03CDE47
:100E000018BEF28E015003D000D0000E016E54EFD8
:100E100007F0EA6A2C0EE96EEF500EE00F0E016E3D
:100E2000006A002EFED7012EFBD78F0E006E002E1B
:100E3000FED70000EF2EF2D768EF07F0F86AD09ED9
:100E4000088EEA6AE96AC150C00B0F09C16E070E2D
:100E5000B46E1F6A236A296A2A6A040E2B6E48D769
:100E60006CD71A5235E0256A036A2A50F2CF2CF06B
:100E7000F29E2CEC01F02CBEF28E266E036A2B50F3
:100E8000F2CF2CF0F29E2CEC01F02CBEF28E276EED
:100E9000286A010E2C6E2E6A250E2D6E306A040E05
:100EA0002F6E020E316E5BD7015201E0292A2950C4
:100EB0000A080BE22A2A2A500F08D8A02A6A2B2AED
:100EC0002B500F08D8A02B6A296A0A0E2C6EA1D7C6
:040ED000C7D703007D
:020000040030CA
:0E000000240E3E1E008381000FC00FE00F4053
:00000001FF
;PIC18F2550
;CRC=A06D CREATED="15-Nov-09 11:02"

7 comments:

  1. sir... pede po ba yn sa pic18f4550.. ung ginwa nyo na ngsulat sa paint.. ayaw po kc sa akin eh..thanks

    ReplyDelete
  2. @raymund
    'di ko pa sir na-try yang F4550, pero gagana rin ata since same family lang sila ni F2550 (i.e. yung mga registers ng F2550 is available din sa F4550).

    ReplyDelete
  3. thanks sir... ok na po gumana na xa... implement ko lng acceleromter para mging mouse na xa.. thanks po gamitin ko po program nyo...^_^

    ReplyDelete
  4. do you have a electronic board images. because http://2.bp.blogspot.com/_meF1KpGU79k/Sv98WYTDKKI/AAAAAAAAAKM/_KiPGOxgJa0/s1600-h/schem.JPG and http://4.bp.blogspot.com/_meF1KpGU79k/Sv9uYXzRJII/AAAAAAAAAKE/b_Yxh7dLqAU/s1600-h/proto.jpg have different Item like "SLWARD". could you show it more detailly? thank you

    ReplyDelete
  5. many thanks there... ok na po gumana na xa... carry out koh lng acceleromter para mging computer mouse button na xa.. thanks po gamitin ko po system nyo

    ReplyDelete
  6. could you please tell me where can i get header files(18F2550.h, pic18_usb.h,
    usb_desc_mouse.h) and usb.c.




    ReplyDelete
  7. could you please tell me which library did you use for this program and how i can get it ?

    ReplyDelete