/Designs/Tools/I2C-PIC-USB/SW/PIC18F4550/main.c
100,7 → 100,7
 
void main()
{
 
unsigned int8 data[64];
unsigned int8 replyBuf[4];
unsigned int8 i=0;
 
121,7 → 121,21
output_high(PIN_B4);
 
usb_init();
usb_wait_for_enumeration();
 
 
printf("device enumerated \n\r ");
 
if(usb_tbe(0)) printf(" endpoint 0 ready \n\r ");
else printf(" endpoint 0 disabled \n\r ");
if(usb_tbe(1)) printf(" endpoint 1 ready \n\r ");
else printf(" endpoint 1 disabled \n\r ");
if(usb_tbe(2)) printf(" endpoint 2 ready \n\r ");
else printf(" endpoint 2 disabled \n\r ");
 
if(usb_puts(0,data,64,1000)) printf(" endpoint 0 inicialized \n\r ");
else printf("cannot write to endpoint 0 \n\r ");
 
while (TRUE) {
if (usb_enumerated())
{
176,12 → 190,14
if(usb_kbhit(i))
{
printf(" data received at endpoint %d \n\r ", i);
usb_gets(i,data,64,1000);
}
 
delay_ms(10);
 
output_high(PIN_B4);
i++;
if( i==1 )i=0;
else i=1;
}
}
}
/Designs/Tools/I2C-PIC-USB/SW/PIC18F4550/main.hex
1,270 → 1,344
:10000000D9EF07F06896000C046ED8CF05F0E0CF6A
:10000000B5EF09F06896000C046ED8CF05F0E0CF8C
:1000100006F00001E9CF0CF0EACF07F0E1CF08F0DD
:10002000E2CF09F0D9CF0AF0DACF0BF0F3CF12F01C
:10003000F4CF13F0FACF14F0F5CF15F0F6CF16F099
:10004000F7CF17F000C00EF001C00FF002C010F0A3
:1000500003C011F0A0AA30EF00F0A1BA5EEF06F0E5
:1000500003C011F0A0AA30EF00F0A1BA9AEF05F0AA
:100060000EC000F00FC001F010C002F011C003F08C
:100070000CC0E9FF07C0EAFF078E08C0E1FF09C016
:10008000E2FF0AC0D9FF0BC0DAFF12C0F3FF13C0B2
:10009000F4FF14C0FAFF15C0F5FF16C0F6FF17C035
:1000A000F7FF045006C0E0FF05C0D8FF1000F76A54
:1000B000BE0FF66E000EF7220900F5501200000385
:1000B000BE0FF66E000EF7220900F550120000FF89
:1000C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF76ADD
:1000D000DE0FF66E000EF7220900F550120000FF49
:1000E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF76ABD
:1000F000FE0FF66E000EF7220900F55012004000C8
:1001000008000000000000000000000000000000E7
:100110000000000000000000000000000000F76A7E
:100120002E0FF66E010EF7220900F5501200400066
:1001300000000000000000000000000000000000BF
:100140000000000000000000000000000000F76A4E
:100150005E0FF66E010EF7220900F5501200050140
:100160000902A1010901A1000509190129031500CE
:100170002501950375018102950175058101050130
:100180000930093109381581257F750895038106E5
:10019000C0C0F76AA20FF66E010EF7220900F550F3
:1001A00012000000F76AB40FF66E010EF722090084
:1001B000F55012003400F76AC60FF66E010EF722F2
:1001C0000900F550120009022200010100C03209A5
:1001D0000400000103010200092100010001223492
:1001E000000705810308000AF76AF80FF66E010E92
:1001F000F7220900F55012000100F76A0A0FF66EA7
:10020000020EF7220900F55012001200F76A1C0FC7
:10021000F66E020EF7220900F550120012011001CD
:10022000FF000040030431C6050201020001F76A25
:100230003E0FF66E020EF7220900F5501200000480
:100240000C00F76A520FF66E020EF7220900F55005
:1002500012000403090408035500530054001C0352
:100260006900320063002D005000490043002D005A
:10027000550053004200200020006D92699468A44C
:1002800002D06894FCD76AEF06F0400E0401016FBB
:10029000040E036F100E026F880E006F046B040EC5
:1002A000076F500E066F0001000C70A002D0EDDF4A
:1002B0007090689A73EF06F06A6A689279EF06F0B8
:1002C0004E904DBE4E804D9E4D50100803E2000EE4
:1002D000016E17D04EA00BD0036A4D50E8DEFF0828
:1002E00002E1000E01D0010E016E0BD00AD0036AAC
:1002F0004D50EDDEFF0802E1000E01D0010E016E4F
:1003000000D0000C036A4C50700FE96E0F0E0320F2
:10031000EA6EEF6A4CC04DF0D3DF015218E04C504A
:10032000080DF3504E6AE96E040E4E24EA6EEF6A31
:100330004C50080DF3504E6A4D6E040E4D26000EC3
:100340004E224DC0E9FF040E4E24EA6EEF6A000C07
:10035000010E4B6E4B500F0805E34BC04CF0D2DF43
:100360004B2AF8D7000C416A41520AE1036A415016
:10037000240FE96E000E0320EA6EEF6A412AF4D7DB
:100380001B6A010E1C6E1A6A000C6A6A686A9F0E6C
:100390006B6E3D0E696E6E6ADBDFE5DF160E706E0A
:1003A00068A602D02FDEFCD76D986FDF030E1F6E9C
:1003B0007FEF06F0698468986D8285EF06F0689C8F
:1003C0008BEF06F046C020F0000CFF0E206E000CF4
:1003D000446A23522AE044503F0827E31D50FC0F93
:1003E00017E2040F1FEF02F0036A2250E4DE456EAD
:1003F0000FD0036A2250ABDE456E0AD0036A22504A
:1004000020DF456E05D0036A225000DF456E00D024
:10041000222A23064450442A036A500FE96E040E30
:100420000320EA6E45C0EFFFD4D7235204E14450C5
:10043000400801E01A6A44C046F0C4DF000CE8241A
:10044000F76AF736590FF66E040EF7220A00F550D8
:10045000FA6E0800F550F96EE803F203FC03060497
:10046000226A1D6A04011351010A000109E0030A0E
:100470000CE0010A0DE0220A18E0030A2BE047D045
:10048000120E236E030E1D6E44D0220E236E41D039
:10049000020E1D6E036A040112510001C8DE226EB5
:1004A000036A2250CEDE236E34D0D8900401123578
:1004B000036A0001A2DE0900F5CF03F0226E223CA0
:1004C00001D006D0036A225076DE236E22D002D0FD
:1004D0007CDF2BD0D89004011435036A000159DE6B
:1004E0000900F5CF03F0226E223C01D00ED0010EA0
:1004F0001D6ED89004011435036A000153DE090013
:10050000F5CF03F0236E05D002D05FDF0ED05DDFA4
:100510000CD00401175305E12350165D02E216C406
:1005200023F0010E1A6E000153DF000C435204E168
:10053000040E1F6E0DDFB1D0050E1F6E040E466E49
:10054000900E456E010E446E44500F08D8A0A5D001
:1005500044C04CF0D7DE476A036A4450B8DDFF0858
:100560004DE0040E476ED8904434036AD8DD09008C
:10057000F5CF03F0486E03C049F04450080DF35026
:100580004C6A4B6E010E4B24016E000E4C20036E24
:1005900001C0E9FF040E0324EA6E48C0EFFF445097
:1005A000080DF3504C6A4B6E020E4B24016E000E88
:1005B0004C20036E01C0E9FF040E0324EA6E46C01E
:1005C000ECFFED5245C0EFFFD8904434036AA7DD3D
:1005D0000900F5CF03F0452603504622880E4A6EE7
:1005E00049B04A8049B24A824450080DF3504C6ADF
:1005F000E96E040E4C24EA6E4AC0EFFF036A4450D1
:1006000056DDFF0834E047824450080DF3504C6A31
:100610004B6E040E4B26000E4C22020E4B24016E34
:10062000000E4C20036E01C0E9FF040E0324EA6EA5
:1006300046C0ECFFED5245C0EFFFD8904434036A4A
:1006400056DD0900F5CF03F04526035046224450FD
:10065000080DF3504C6A4B6E040E4B26000E4C22D4
:100660004BC0E9FF040E4C24EA6E400EEF6E47507B
:10067000060802E10E0E476E036A445018DD0108B9
:10068000D8A44788036A4450700FE96E0F0E032008
:10069000EA6E47C0EFFF442A57D79AEF03F00401F0
:1006A0001151000A00010DE0010A14E0020A1EE0E7
:1006B000060A27E0030A2CE00E0A2CE0010A30E0CB
:1006C0003DD01CC050F40401516B020E466E000177
:1006D00079DE36D00401122D06D0010E1C16466AB2
:1006E000000170DE02D0000170DE2AD00401122D5C
:1006F00005D01C82466A000165DE02D0000165DE7D
:100700001FD0020E1A6E12C421F0466A5BDE18D0AA
:10071000A7DE16D01BC050F4010E466E53DE10D07B
:1007200004011251010808E312C41BF012C443F083
:100730000001FCD6466A46DE000102D046DE00D04B
:10074000ADEF04F01BC043F004011151000A000199
:1007500007E00A0A0DE0010A28E00D0A38E039D066
:100760000401506B516B020E466E00012BDE33D03C
:10077000435219E0010E435C036A36DD016E040149
:10078000145DD8A002D000010ED0036A1451240FCA
:10079000E96E000E0320EA6EEFCF50F4010E466EB4
:1007A000000110DE01D011DE16D043520EE0036AC4
:1007B00004011451240FE96E000E0320EA6E12C4E6
:1007C000EFFF466A0001FEDD01D0FFDD04D048DE08
:1007D00002D0FBDD00D0ADEF04F0449043BE448076
:1007E000439E44A011D04350080DF350466A456E15
:1007F000040E4526000E462245C0E9FF040E46249D
:10080000EA6E880EEF6E09D04350080DF350466A29
:10081000E96E040E4624EA6EEF6A6FEF04F044902E
:1008200043BE4480439E44A011D04350080DF35072
:10083000466A456E040E4526000E462245C0E9FF75
:10084000040E4624EA6E840EEF6E0AD04350080D63
:10085000F350466AE96E040E4624EA6E840EEF6E8B
:1008600075EF04F0449043BE4480439E44A011D0F1
:100870004350080DF350476A466E040E4626000E9C
:10088000472246C0E9FF040E4724EA6EEFCF45F049
:100890000AD04350080DF350476AE96E040E47240E
:1008A000EA6EEFCF45F045AE02D045B402D0000E5F
:1008B00001D0010E016E7FEF04F014C44DF000DD95
:1008C000015229E004011151010A000105E0020A68
:1008D00009E0030A0DE01DD014C443F07ED7466A38
:1008E00071DD19D014C443F09AD7466A6BDD13D07A
:1008F0000401506B516B14C443F00001B3D7015293
:1009000004E0010E0401506F0001020E466E5ADD34
:1009100002D05BDD00D0ADEF04F00401115100D036
:10092000000153DD00D0ADEF04F01A6A040110514C
:100930007F0B000A000107E0010A07E0030A07E055
:10094000230A07E008D0ABD608D0FCD606D0B5D72E
:1009500004D0E3D702D039DD00D0CDEF05F043500D
:10096000080DF350496AE96E040E4924EA6EEFCF90
:1009700045F04450020806E145AC02D0446A02D07A
:10098000010E446E4450030813E1840E456E43503B
:10099000080DF350496A486E040E4826000E49229D
:1009A00048C0E9FF040E4924EA6E840EEF6E07D0BA
:1009B000442C03D0C80E456E02D0880E456ED890E8
:1009C0004334036A8FEC00F00900F5CF03F0466E64
:1009D00003C047F04350080DF350496A486E010EBA
:1009E0004824016E000E4920036E01C0E9FF040E89
:1009F0000324EA6E46C0EFFF47B0458047B2458208
:100A00004350080DF350496AE96E040E4924EA6E1A
:100A100045C0EFFF000C036A4850700FE96E0F0EDF
:100A20000320EA6EEF5212E04850080DF3504A6A74
:100A3000496E040E4926000E4A2249C0E9FF040E01
:100A40004A24EA6EEFCF49F049AE02D0000E01D041
:100A5000010E016E2FEF05F043C048F0DCD70152C4
:100A600062E04350080DF350496A486E040E482670
:100A7000000E4922010E4824016E000E4920036E2B
:100A800001C0E9FF040E0324EA6E44C0EFFF4650A4
:100A9000020817E14350080DF350496A486E040EEE
:100AA0004826000E492248C0E9FF040E4924EA6E98
:100AB000EFCF47F047AC02D0466A02D0010E466E37
:100AC00013D04650040810E14350080DF350496A12
:100AD000E96E040E4924EA6EEFCF47F047AC03D02D
:100AE000010E466E01D0466A462C03D0C80E476EF2
:100AF00002D0880E476E45B0478045B247824350CA
:100B0000080DF350496A486E040E4826000E49222B
:100B100048C0E9FF040E4924EA6E47C0EFFF010E0A
:100B2000016E03D000D0000E016E000C435200E1B4
:100B3000000C44C06EFF445203E0040E1F6E02D04E
:100B4000020E1F6EA9EF05F01B6A1A6A21C044F05D
:100B5000F0D7B5EF05F0435208E11A2C02D038DC8B
:100B600004D01A50020801E1EFD7000C1E30416E8C
:100B7000413241321F0E41161E5242E10401005122
:100B80003C0B426E430E0017425034081EE10451E4
:100B9000800B01E0046B0001C8D66D98203C05D0A5
:100BA000436A030E446EDBDE0ED0436A020E446ECF
:100BB000D6DE2050FE0807E0436A456A20C044F0B4
:100BC000040E466E49DF19D004014250040816E1B4
:100BD000436A0001ABDF436A020E446EC0DE205060
:100BE000FE080AE0203C01D007D0436A456A20C0D5
:100BF00044F0010E466E30DF00D004015CD00001ED
:100C00001E50040814E1430E04010417FF0E206E69
:100C1000436A0001A0DF203C01D008D0436A456A46
:100C200020C044F0020E466E17DF00D043D01EB441
:100C30001BD04150080DF350446A016E040E442449
:100C4000036E4150080DF350466AE96E040E4624C7
:100C5000EA6EEF50430B03C0EAFF01C0E9FFEF6EFD
:100C600041C043F063DF26D04150080DF350446A81
:100C7000436E040E4326000E442243C001F0040ECE
:100C80004424036E4150080DF350466A456E040E2D
:100C90004526000E462245C0E9FF040E4624EA6EB2
:100CA000EF50430B03C0EAFF43C0E9FFEF6E41C0C2
:100CB00043F051DF0401000195EF06F0A19A1F52A5
:100CC00001E139D0685237E068A404D069A402D0A9
:100CD0003DEF01F06DA201D02ED068AA04D069AA20
:100CE00002D055EF01F068A204D069A202D05CEFF7
:100CF00001F068A004D069A002D0C5EF01F068A897
:100D000004D069A802D0DAEF01F068AC04D069AC75
:100D100002D0DFEF01F0406A68A608D069A606D0CD
:100D20006CCF1EF002EC00F021D701D004D040506F
:100D3000402A0308F1E230EF00F04D4C41422049D7
:100D4000324320746F205553422061646170746592
:100D5000722073746172746564200A0D200020642F
:100D600061746120726563656976656420617420D1
:100D7000656E64706F696E74202564200A0D200012
:100D80000900F5520DE0F6CF37F0F7CF38F0F55007
:100D90009EA8FED7AD6E37C0F6FF38C0F7FFF0D77C
:100DA0001FEF08F06D6A696A080E6F6E9450300983
:100DB000946E1F6A196AF2BE198EF29EB3EC01F0AE
:100DC00019BEF28E000CEEDF11EF07F0196AF2BEC9
:100DD000198EF29EB3EC01F019BEF28E6D6A140EFC
:100DE0006F6E696A6D86010E1F6EFDEF06F09588C5
:100DF00083A804D06DB601D0E9D703D06DA601D089
:100E0000D1DF1F2C0BD06DBA09D0686A696AA08A3D
:100E1000C00EF212110E696E020E1F6E12EF07F075
:100E2000D2D7E5D71F500208FCE122EF08F01B5093
:100E3000016E23EF08F0036A3750700FE96E0F0E52
:100E40000320EA6EEF520DE03750080DF350396A77
:100E5000386EE96E040E3924EA6EEFCF38F038AE02
:100E600002D0000E01D0010E016E2AEF08F0090039
:100E7000F6CF38F0F7CF39F0F5509EA8FED7AD6E1B
:100E800038C0F6FF39C0F7FF372EF1D7000C3E50BF
:100E9000016A3D5C03E23DC000F00CD0006A080E20
:100EA0003F6E3D3600363E50005CD8B0006E0136D5
:100EB0003F2EF7D7000C200E38A8300E396E37C001
:100EC00000F037AE07D0001E002A00C037F02D0E0C
:100ED000396E388E015037C03DF0640E3E6ED7DF5C
:100EE00000C037F0300E01243A6E37C03DF00A0ED4
:100EF0003E6ECDDF300E00243C6E300E01243B6E82
:100F000039C000F038A602D038AE389438B80BD0CB
:100F100038AE22D038B420D000C03AF038B21CD05D
:100F200000C03BF019D0300E3A5C16E100C03AF038
:100F3000200E396E38A604D03894388238AE3892F4
:100F4000300E3B5C09E100C03BF0200E3A6E38A643
:100F5000F7D7389238AE389038A404D039509EA8CC
:100F6000FED7AD6E38A204D03A509EA8FED7AD6E23
:100F700038A004D03B509EA8FED7AD6E3C509EA832
:100F8000FED7AD6E38EF08F0EA6A370EE96EEF5023
:100F90000EE00F0E016E006A002EFED7012EFBD769
:100FA0008F0E006E002EFED70000EF2EF2D742EF1C
:100FB00008F0F86AD09E078EEA6AE96AB886E10E00
:100FC000AF6E040EB06EA60EAC6E900EAB6E1F6AC6
:100FD000236A0A0E256E050E266E316AC150C00BBB
:100FE0000F09C16E070EB46E2790286A366AC15089
:100FF000C00B0F09C16EC090C092C094C09EC28049
:101000009698D190800ED56ECD6A000ECA6E000EF5
:10101000CB6EB16A9484BD6AB76AB66A070EB46EC5
:101020009250926E270E006E002EFED700D0B45064
:10103000A19CB56A3A0EF66E0D0EF76EA1D6939886
:101040008A88EED6F4D6015220E093988A9836C06A
:1010500037F0F1D6015213E05E0EF66E0D0EF76E0C
:101060001B0E376E04DF36C037F01F0E386E23D7E5
:101070007B0EF66E0D0EF76E040E376EF8DE0A0E5E
:0E108000376E82D793988A88362ADCD7030011
:1000D000DE0FF66E000EF7220900F5501200400008
:1000E0000000000000000000000000000000000010
:1000F0000000000000000000000000000000F76A9F
:100100000E0FF66E010EF7220900F55012000902DB
:100110002000010100C0320904000002FFFFFF00BF
:100120000705800040000A0705000040000AF76A42
:100130003E0FF66E010EF7220900F5501200010085
:10014000F76A500FF66E010EF7220900F550120003
:1001500012011001FF000040030431C60502010234
:100160000001F76A720FF66E010EF7220900F550D2
:10017000120000040C00F76A860FF66E010EF722DB
:100180000900F55012000403090408035500530048
:1001900054001C036900320063002D005000490028
:1001A00043002D00550053004200200020006D92B6
:1001B000699468A402D06894FCD7A6EF05F0400EBD
:1001C0000401016F040E036F080E026F880E006FAA
:1001D000046B040E076F480E066F0001000C70A040
:1001E00002D0EDDF7090689AAFEF05F06A6A68920E
:1001F000B5EF05F0A891A7BFA881A79FA751100848
:1002000003E2000E016E17D0A8A10BD0036AA7511C
:100210004EDFFF0802E1000E01D0010E016E0BD08F
:100220000AD0036AA75143DFFF0802E1000E01D0A4
:10023000010E016E00D0000C036AA651700FE96E2A
:100240000F0E0320EA6EEF6AA6C0A7F0D3DF0152BB
:1002500018E0A651080DF350A86BE96E040EA8250E
:10026000EA6EEF6AA651080DF350A86BA76F040E53
:10027000A727000EA823A7C0E9FF040EA825EA6E51
:10028000EF6A000C010EA56FA5510F0805E3A5C08C
:10029000A6F0D2DFA52BF8D7000C9B6B9B530AE18D
:1002A000036A9B51240FE96E000E0320EA6EEF6A89
:1002B0009B2BF4D71B6A010E1C6E1A6A000C6A6A2B
:1002C000686A9F0E6B6E3D0E696E6E6ADBDFE5DF5E
:1002D000160E706E68A602D095DEFCD76D986FDFA3
:1002E000030E1F6EBBEF05F0698468986D82C1EF45
:1002F00005F0689CC7EF05F0A0C020F0000CFF0ED1
:10030000206E000C9E6B235226E09E513F0823E393
:100310001D5005E0020A08E0010A0BE00FD0036A55
:100320002250EDDE9F6F0AD0036A225024DF9F6FB8
:1003300005D0036A225004DF9F6F00D0222A2306D3
:100340009E519E2B036A480FE96E040E0320EA6E4D
:100350009FC0EFFFD8D7235204E19E51400801E02F
:100360001A6A9EC0A0F0C8DF000C226A1D6A040150
:100370000B51010A000105E0030A08E0010A09E047
:1003800015D0120E236E030E1D6E12D0200E236E9A
:100390000FD0020E1D6E036A04010A510001E1DE56
:1003A000226E036A2250E7DE236E02D0A8DF0CD053
:1003B00004010F5305E123500E5D02E20EC423F049
:1003C000010E1A6E00019EDFF0EF02F09D5304E172
:1003D000040E1F6E57DFB1D0050E1F6E040EA06F06
:1003E000880E9F6F010E9E6F9E510F08D8A0A5D05A
:1003F0009EC0A6F021DFA16B036A9E5158DEFF0864
:100400004DE0040EA16FD8909E35036A60DE0900AE
:10041000F5CF03F0A26F03C0A3F09E51080DF35077
:10042000A66BA56F010EA525016E000EA621036E19
:1004300001C0E9FF040E0324EA6EA2C0EFFF9E5143
:10044000080DF350A66BA56F020EA525016E000ED8
:10045000A621036E01C0E9FF040E0324EA6EA0C0CA
:10046000ECFFED529FC0EFFFD8909E35036A2FDE60
:100470000900F5CF03F09F270350A023880EA46F37
:10048000A3B1A481A3B3A4839E51080DF350A66B1E
:10049000E96E040EA625EA6EA4C0EFFF036A9E5122
:1004A00006DEFF0834E0A1839E51080DF350A66BD1
:1004B000A56F040EA527000EA623020EA525016E2A
:1004C000000EA621036E01C0E9FF040E0324EA6EAC
:1004D000A0C0ECFFED529FC0EFFFD8909E35036A9D
:1004E000F6DD0900F5CF03F09F270350A0239E51AE
:1004F000080DF350A66BA56F040EA527000EA623CA
:10050000A5C0E9FF040EA625EA6E400EEF6EA151CC
:10051000060802E10E0EA16F036A9E51C8DD0108B4
:10052000D8A4A189036A9E51700FE96E0F0E0320B3
:10053000EA6EA1C0EFFF9E2B57D7EAEF02F004014D
:100540000951000A00010DE0010A14E0020A1EE050
:10055000060A27E0030A2CE00E0A2CE0010A30E02C
:100560003DD01CC048F40401496B020E0001A06F8D
:10057000C3DE36D004010A2D06D0010E1C16000180
:10058000A06BBADE02D00001BADE2AD004010A2D27
:1005900005D01C820001A06BAFDE02D00001AFDEEF
:1005A0001FD0020E1A6E0AC421F0A06BA5DE18D06F
:1005B000DCD616D01BC048F4010EA06F9DDE10D013
:1005C00004010A51010808E30AC41BF00AC49DF0A3
:1005D0000001FCD6A06B90DE000102D090DE00D0BE
:1005E000EDEF03F01BC09DF004010951000A00016A
:1005F00005E00A0A0BE0010A26E037D00401486B47
:10060000496B020E0001A06F77DE31D09D5319E0D7
:10061000010E9D5D036A8BDD016E04010C5DD8A0A7
:1006200002D000010ED0036A0C51240FE96E000EB7
:100630000320EA6EEFCF48F4010E0001A06F5CDEEC
:1006400001D05DDE14D09D530EE0036A04010C510D
:10065000240FE96E000E0320EA6E0AC4EFFF0001CA
:10066000A06B4ADE01D04BDE02D049DE00D0EDEFB8
:1006700003F09E919DBF9E819D9F9EA111D09D5193
:10068000080DF350A06B9F6F040E9F27000EA02350
:100690009FC0E9FF040EA025EA6E880EEF6E09D018
:1006A0009D51080DF350A06BE96E040EA025EA6E73
:1006B000EF6ABBEF03F09E919DBF9E819D9F9EA11F
:1006C00011D09D51080DF350A06B9F6F040E9F2712
:1006D000000EA0239FC0E9FF040EA025EA6E840E41
:1006E000EF6E0AD09D51080DF350A06BE96E040E19
:1006F000A025EA6E840EEF6EC1EF03F09E919DBFC0
:100700009E819D9F9EA111D09D51080DF350A16B1C
:10071000A06F040EA027000EA123A0C0E9FF040EC5
:10072000A125EA6EEFCF9FF00AD09D51080DF3503E
:10073000A16BE96E040EA125EA6EEFCF9FF09FAF8B
:1007400002D09FB502D0000E01D0010E016ECBEF9A
:1007500003F00CC4A7F04EDD015229E00401095159
:10076000010A000105E0020A09E0030A0DE01DD0BC
:100770000CC49DF07ED7A06BBFDD19D00CC49DF0DA
:100780009AD7A06BB9DD13D00401486B496B0CC438
:100790009DF00001B3D7015204E0010E0401486F3F
:1007A0000001020EA06FA8DD02D0A9DD00D0EDEFA0
:1007B00003F01A6A040108517F0B000A000105E0EA
:1007C000010A05E0030A05E006D0B9D606D00AD72B
:1007D00004D0BFD702D093DD00D00FEF05F09D51BC
:1007E000080DF350A36BE96E040EA325EA6EEFCF5C
:1007F0009FF09E51020806E19FAD02D09E6B02D091
:10080000010E9E6F9E51030813E1840E9F6F9D5150
:10081000080DF350A36BA26F040EA227000EA323B2
:10082000A2C0E9FF040EA325EA6E840EEF6E07D086
:100830009E2D03D0C80E9F6F02D0880E9F6FD89058
:100840009D35036A44DC0900F5CF03F0A06F03C0B7
:10085000A1F09D51080DF350A36BA26F010EA225CC
:10086000016E000EA321036E01C0E9FF040E0324F4
:10087000EA6EA0C0EFFFA1B19F81A1B39F839D51FC
:10088000080DF350A36BE96E040EA325EA6E9FC01A
:10089000EFFF000C036AA251700FE96E0F0E0320E8
:1008A000EA6EEF5212E0A251080DF350A46BA36F51
:1008B000040EA327000EA423A3C0E9FF040EA42561
:1008C000EA6EEFCFA3F0A3AF02D0000E01D0010E6D
:1008D000016E000C9DC0A2F0DDDF015262E09D516F
:1008E000080DF350A36BA26F040EA227000EA323E2
:1008F000010EA225016E000EA321036E01C0E9FFC7
:10090000040E0324EA6E9EC0EFFFA051020817E117
:100910009D51080DF350A36BA26F040EA227000E89
:10092000A323A2C0E9FF040EA325EA6EEFCFA1F036
:10093000A1AD02D0A06B02D0010EA06F13D0A051C8
:10094000040810E19D51080DF350A36BE96E040EED
:10095000A325EA6EEFCFA1F0A1AD03D0010EA06FE9
:1009600001D0A06BA02D03D0C80EA16F02D0880EBD
:10097000A16F9FB1A1819FB3A1839D51080DF35039
:10098000A36BA26F040EA227000EA323A2C0E9FF4F
:10099000040EA325EA6EA1C0EFFF010E016E03D085
:1009A00000D0000E016E000C9D5300E1000C9EC0B3
:1009B0006EFF9E5303E0040E1F6E02D0020E1F6EE8
:1009C000E7EF04F01B6A1A6A21C09EF0F0D7F3EF3C
:1009D00004F09D5308E11A2C02D094DC04D01A5084
:1009E000020801E1EFD7000C1E309B6F9B339B3355
:1009F0001F0E9B171E5242E1040100513C0B0001E7
:100A00009C6F430E0401001700019C5134081EE145
:100A100004010451800B01E0046B0001CAD66D98FB
:100A2000203C05D09D6B030E9E6FD9DE0ED09D6BD2
:100A3000020E9E6FD4DE2050FE0807E09D6B9F6B78
:100A400020C09EF0040EA06F45DF17D09C51040813
:100A500014E19D6BA9DF9D6B020E9E6FC0DE2050DE
:100A6000FE080AE0203C01D007D09D6B9F6B20C0A0
:100A70009EF0010EA06F2EDF00D05AD01E50040849
:100A800014E1430E04010417FF0E206E00019D6B5C
:100A9000A0DF203C01D008D09D6B9F6B20C09EF052
:100AA000020EA06F17DF00D043D01EB41BD09B51A5
:100AB000080DF3509E6B016E040E9E25036E9B5134
:100AC000080DF350A06BE96E040EA025EA6EEF50FE
:100AD000430B03C0EAFF01C0E9FFEF6E9BC09DF02E
:100AE00063DF26D09B51080DF3509E6B9D6F040E63
:100AF0009D27000E9E239DC001F0040E9E25036ECF
:100B00009B51080DF350A06B9F6F040E9F27000EA2
:100B1000A0239FC0E9FF040EA025EA6EEF50430B0F
:100B200003C0EAFF9DC0E9FFEF6E9BC09DF051DF5F
:100B3000D1EF05F0A19A1F5201E139D0685237E098
:100B400068A404D069A402D0D7EF00F06DA201D050
:100B50002ED068AA04D069AA02D0EFEF00F068A2F4
:100B600004D069A202D0F6EF00F068A004D069A01A
:100B700002D05FEF01F068A804D069A802D074EF3A
:100B800001F068AC04D069AC02D079EF01F09A6B47
:100B900068A608D069A606D06CCF1EF002EC00F063
:100BA00023D701D004D09A519A2B0308F1E230EFF9
:100BB00000F04D4C41422049324320746F20555380
:100BC000422061646170746572207374617274652F
:100BD00064200A0D200064657669636520656E7582
:100BE0006D657261746564200A0D200020656E6475
:100BF000706F696E742030207265616479200A0D0F
:100C0000200020656E64706F696E74203020646906
:100C10007361626C6564200A0D20000020656E64BB
:100C2000706F696E742031207265616479200A0DDD
:100C3000200020656E64706F696E742031206469D5
:100C40007361626C6564200A0D20000020656E648B
:100C5000706F696E742032207265616479200A0DAC
:100C6000200020656E64706F696E742032206469A4
:100C70007361626C6564200A0D20000020656E645B
:100C8000706F696E74203020696E696369616C6988
:100C90007A6564200A0D200063616E6E6F742077A0
:100CA0007269746520746F20656E64706F696E740C
:100CB0002030200A0D2000002064617461207265DC
:100CC00063656976656420617420656E64706F6920
:100CD0006E74202564200A0D20000900F5520DE0F5
:100CE000F6CF77F0F7CF78F0F5509EA8FED7AD6E2F
:100CF00077C0F6FF78C0F7FFF0D7000C6D6A696A1D
:100D0000080E6F6E94503009946E1F6A196AF2BE15
:100D1000198EF29E4DEC01F019BEF28E000CEEDF42
:100D2000BDEF06F0196AF2BE198EF29E4DEC01F08D
:100D300019BEF28E6D6A140E6F6E696A6D86010EB1
:100D40001F6EA9EF06F0958883A804D06DB601D078
:100D5000E9D703D06DA601D0D1DF1F2C0BD06DBA1F
:100D600009D0686A696AA08AC00EF212110E696E13
:100D7000020E1F6EBEEF06F0D2D7E5D71F50020855
:100D8000FCE1FEEF09F01B5202E10400FCD7FFEF8B
:100D900009F0946B956B010E966FDA6AD96A996BBC
:100DA0008C0E986FEA6A900EE96E99C0E2FF98C0C7
:100DB000E1FF96C097F0D890E550EE02F3509423EF
:100DC000F4509523972FF7D794C0DEFF95C094F089
:100DD000956BD8B0952B982BD8B4992B962B965110
:100DE0000508E0E1000C196AF2BE198EF29E8AC075
:100DF000A2F050DD19BEF28E015245E08A51080D75
:100E0000F350936B926F040E9227000E9323020E01
:100E10009225016E000E9321036E01C0E9FF040EBE
:100E20000324EA6EECCF03F0ED52EFCF90F003C055
:100E300091F091C0EAFF90C0E9FF8CC0E2FF8BC047
:100E4000E1FF8EC002F08DC001F0015202E0022AE3
:100E500002D0025206E0E6CFEEFF012EFCD7022EB2
:100E6000FAD7196AF2BE198EF29E8AC09DF08EC022
:100E70009FF08DC09EF08FC0A0F02CDD19BEF28EC9
:100E8000015003D000D0000E016E000C7E6B7D6B14
:100E9000D8907735036A67EC00F00900F5CF03F0CE
:100EA000826F03C083F07E517B5DD8A06BD003E1DD
:100EB0007A517D5D67E28B6B8A6B896B7CC088F0B1
:100EC0008BC08FF08AC08EF089C08DF07CC08CF012
:100ED000936B926B030E916FE80E906F5ADF03C015
:100EE00087F002C086F001C085F000C084F07D511B
:100EF0007A5D886F7E517B59896F8351895D09E3E3
:100F000003E18851825D05E283C081F082C080F0F8
:100F100006D07D517A5D806F7E517B59816F7D5106
:100F20007825886F7E517921896F77C08AF08C6F20
:100F300088C08BF081C08EF080C08DF0020E8F6F64
:100F400052DF7F9101B07F817FB10DD0030E006E23
:100F5000002EFED700D0FF0E8427D8A08527D8A06A
:100F60008627D8A087277FB108D08453D8E185533E
:100F7000D6E18653D4E18753D2E182517D27835154
:100F80007E2391D77A517D5D44E17B517E5D41E1C5
:100F90008B6B8A6B896B7CC088F08BC08FF08AC0AA
:100FA0008EF089C08DF07CC08CF0936B926B030E39
:100FB000916FE80E906FEDDE03C087F002C086F0FF
:100FC00001C085F000C084F077C08AF08C6B8B6B19
:100FD0008E6B8D6B020E8F6F06DF7F9101B07F816C
:100FE0007FB10DD0030E006E002EFED700D0FF0E95
:100FF0008427D8A08527D8A08627D8A087277FB1A7
:1010000008D08453E1E18553DFE18653DDE1875366
:10101000DBE1000E7FB1010E016E52EF0AF01B50B2
:10102000016E60EF0AF0036A8851700FE96E0F0ECF
:101030000320EA6EEF520DE08851080DF3508A6BE1
:10104000896FE96E040E8A25EA6EEFCF89F089AFC9
:1010500002D0000E01D0010E016E000C0900F6CF87
:1010600078F0F7CF79F0F5509EA8FED7AD6E78C036
:10107000F6FF79C0F7FF772FF1D7000C7E51016A98
:101080007D5D03E27DC000F00CD0006A080E7F6F2A
:101090007D3700367E51005CD8B0006E01367F2F60
:1010A000F7D7000C200E78A9300E796F77C000F0CA
:1010B00077AF07D0001E002A00C077F02D0E796FA1
:1010C000788F015077C07DF0640E7E6FD7DF00C04F
:1010D00077F0300E01247A6F77C07DF00A0E7E6FB4
:1010E000CDDF300E00247C6F300E01247B6F79C081
:1010F00000F078A702D078AF789578B90BD078AFA8
:1011000022D078B520D000C07AF078B31CD000C0CF
:101110007BF019D0300E7A5D16E100C07AF0200E17
:10112000796F78A704D07895788378AF7893300E6C
:101130007B5D09E100C07BF0200E7A6F78A7F7D7BE
:10114000789378AF789178A504D079519EA8FED78E
:10115000AD6E78A304D07A519EA8FED7AD6E78A16B
:1011600004D07B519EA8FED7AD6E7C519EA8FED7C1
:10117000AD6E75EF0AF08D51080DF350986B976FB7
:10118000020E9725016E000E9821036E01C0E9FF43
:10119000040E0324EA6EECCF03F0ED52EFCF92F091
:1011A00003C093F08D51080DF350986B976F010EAB
:1011B0009725016E000E9821036E01C0E9FF040E11
:1011C0000324EA6EEF50036A956F03C096F08D51C9
:1011D000080DF350986BE96E040E9825EA6EEFCF78
:1011E00094F094B1968194B396839651915D08E3FF
:1011F00003E19051955D04E296C091F095C090F0A6
:101200008FC0EAFF8EC0E9FF93C0E2FF92C0E1FF0A
:1012100091C002F090C001F0015202E0022A02D017
:10122000025206E0E6CFEEFF012EFCD7022EFAD7DF
:1012300090C001F091C002F029EF09F088C08DF054
:101240008AC08FF089C08EF08CC091F08BC090F076
:1012500092D702C08CF001C08BF0196AF2BE198ED1
:10126000F29E88C09DF0020E9E6FEFEC03F019BE57
:10127000F28E8BC001F08CC002F082EF09F0EA6AB6
:10128000880EE96EEF500EE00F0E016E006A002E20
:10129000FED7012EFBD78F0E006E002EFED700006A
:1012A000EF2EF2D7000C7F6B7E6BD8907735036AF8
:1012B00067EC00F00900F5CF03F0846F03C085F000
:1012C00085517B5D09E303E17A51845D05E285C0C8
:1012D00087F084C086F004D07BC087F07AC086F0A7
:1012E000816B806B77C088F09EDE01521DE077C075
:1012F00088F079C08AF078C089F087C08CF086C009
:101300008BF09CD702C083F001C082F08251782715
:101310008351792382517A5F83517B5B82517E278F
:1013200083517F230DD006D0802BD8B4812B010EA2
:10133000886FA5DF7C51805DD5E17D51815DD2E173
:101340008451825D0CE18551835D09E17C51805DB2
:1013500003E17D51815D03E07A517B11B1E17EC0F3
:1013600001F07FC002F089EF0AF0F86AD09E078E84
:10137000EA6AE96AB886E10EAF6E040EB06EA60E98
:10138000AC6E900EAB6E1F6A236A0A0E256E050EB8
:10139000266E316AC150C00B0F09C16E070EB46EC4
:1013A0002790286A766BC150C00B0F09C16EC090A0
:1013B000C092C094C09EC2809698D190800ED56E87
:1013C000CD6A000ECA6E000ECB6EB16A9484BD6AFF
:1013D000B76AB66A070EB46E9250926E270E006E10
:1013E000002EFED700D0B450A19CB56AB20EF66EA6
:1013F0000B0EF76E72DC93988A88BED4C4D4D60ED6
:10140000F66E0B0EF76E69DC196AF2BE198EF29E4B
:10141000A26B4AEC04F019BEF28E015206E0EC0E0B
:10142000F66E0B0EF76E59DC05D0020EF66E0C0E42
:10143000F76E53DC196AF2BE198EF29E010EA26F8E
:101440004AEC04F019BEF28E015206E01C0EF66E54
:101450000C0EF76E42DC05D0320EF66E0C0EF76EF7
:101460003CDC196AF2BE198EF29E020EA26F4AECA3
:1014700004F019BEF28E015206E04C0EF66E0C0E10
:10148000F76E2BDC05D0620EF66E0C0EF76E25DCC7
:10149000776B796B320E786F7B6B400E7A6FE80E4C
:1014A0007C6FF4D4015206E07C0EF66E0C0EF76EE3
:1014B00014DC05D0980EF66E0C0EF76E0EDCAFD570
:1014C000015232E093988A9876C088F0ACDD0152E0
:1014D00020E0B80EF66E0C0EF76E1B0E776FBEDDB9
:1014E00076C077F01F0E786FDDD5D50EF66E0C0E38
:1014F000F76E040E776FB2DD76C077F0796B320E3F
:10150000786F7B6B400E7A6F030E7D6FE80E7C6FF9
:10151000CAD60A0E886FB3DE93988A88762D02D0D9
:0C152000766B02D0010E766FCAD7030074
:020000040030CA
:0E00000024CE390E0085A1000FC00FE00F4086
:00000001FF
;PIC18F4550
;CRC=C035 CREATED="29-IX-13 15:44"
;CRC=DB55 CREATED="04-X-13 23:42"
/Designs/Tools/I2C-PIC-USB/SW/PIC18F4550/usbconfig.h
44,86 → 44,29
//////// end config ///////////////////////////////////////////////////////////
 
 
//#DEFINE USB_CONFIG_BUS_POWER FALSE
//#define USB_USE_FULL_SPEED FALSE
 
#DEFINE USB_HID_DEVICE TRUE //Tells the CCS PIC USB firmware
//to include HID handling code.
#DEFINE USB_HID_DEVICE FALSE //Tells the CCS PIC USB firmware
//Enable to include HID handling code.
 
//turn on EP1 for IN interrupt transfers. (IN = PIC -> PC)
#define USB_EP1_TX_ENABLE USB_ENABLE_INTERRUPT
//turn on EP0 for IN control transfers. (IN = PIC -> PC)
#define USB_EP0_TX_ENABLE USB_ENABLE_CONTROL
#define USB_EP0_TX_SIZE 64 //max packet size of this endpoint
 
#define USB_EP1_TX_SIZE 8 //max packet size of this endpoint
#define USB_EP0_RX_ENABLE USB_ENABLE_CONTROL
#define USB_EP0_RX_SIZE 64 //max packet size of this endpoint
 
#include <usb.h>
//#define USB_EP1_TX_ENABLE USB_ENABLE_CONTROL
//#define USB_EP1_TX_SIZE 8 //max packet size of this endpoint
 
//////////////////////////////////////////////////////////////////
///
/// HID Report. Tells HID driver how to handle and deal with
/// received data. HID Reports can be extremely complex,
/// see HID specifcation for help on writing your own.
///
/// This examples configures HID driver to take received data
/// as mouse x, y and button data.
///
//////////////////////////////////////////////////////////////////
//#define USB_EP1_RX_ENABLE USB_ENABLE_CONTROL
//#define USB_EP1_RX_SIZE 8 //max packet size of this endpoint
 
const char USB_CLASS_SPECIFIC_DESC[] =
{
0x05, 0x01, // usage page (generic desktop Choose the usage page "mouse" is on
0x09, 0x02, // usage (mouse) Device is a mouse
0xA1, 0x01, // collection (application) This collection encompasses the report format
0x09, 0x01, // usage (pointer) Choose the key code usage page
0xA1, 0x00, // collection (physical) Physical collection
0x05, 0x09, // usage page (buttons) Choose the “button” usage page
0x19, 0x01, // usage minimum (1) There are three buttons
0x29, 0x03, // usage maximum (3)
0x15, 0x00, // logical minimum (0) Each button is represented by one bit
0x25, 0x01, // logical maximum (1)
0x95, 0x03, // report count (3) Three reports, one bit each
0x75, 0x01, // report size (1)
0x81, 0x02, // input (data, variable, absolute) Defined bits above are data bits
0x95, 0x01, // report count (1) One report, five bits in length
0x75, 0x05, // report size (5)
0x81, 0x01, // input (constant) Bit stuff to fill byte
0x05, 0x01, // usage page (generic desktop) Choose the usage pare “X” and “Y” are on
0x09, 0x30, // usage (X) X direction of pointer
0x09, 0x31, // usage (Y) Y direction of pointer
0x09, 0x38 // usage (wheel)
0x15, 0x81, // logical minimum (-127) Range of report data is -127 to 127
0x25, 0x7F, // logical maximum (127)
0x75, 0x08, // report size (8) Two reports, eight bits each
0x95, 0x03, // report count (3)
0x81, 0x06, // input (data, variable, absolute) Defined bits above are data bits
0xC0, // end collection End physical collection
0xC0 // end collection End application collection
};
 
//if a class has an extra descriptor not part of the config descriptor,
// this lookup table defines where to look for it in the const
// USB_CLASS_SPECIFIC_DESC[] array.
//first element is the config number (if your device has more than one config)
//second element is which interface number
//set element to 0xFFFF if this config/interface combo doesn't exist
const int16 USB_CLASS_SPECIFIC_DESC_LOOKUP[USB_NUM_CONFIGURATIONS][1] =
{
//config 1
//interface 0
0
};
 
//if a class has an extra descriptor not part of the config descriptor,
// this lookup table defines the size of that descriptor.
//first element is the config number (if your device has more than one config)
//second element is which interface number
//set element to 0xFFFF if this config/interface combo doesn't exist
const int16 USB_CLASS_SPECIFIC_DESC_LOOKUP_SIZE[USB_NUM_CONFIGURATIONS][1] =
{
//config 1
//interface 0
sizeof(USB_CLASS_SPECIFIC_DESC)
};
#include <usb.h>
 
 
 
//////////////////////////////////////////////////////////////////
///
/// start config descriptor
132,7 → 75,7
///
//////////////////////////////////////////////////////////////////
 
#DEFINE USB_TOTAL_CONFIG_LEN 34 //config+interface+class+endpoint
#DEFINE USB_TOTAL_CONFIG_LEN 32 //config+interface+class+endpoint
 
const char USB_CONFIG_DESC[] = {
//IN ORDER TO COMPLY WITH WINDOWS HOSTS, THE ORDER OF THIS ARRAY MUST BE:
160,27 → 103,35
USB_DESC_INTERFACE_TYPE, //constant INTERFACE (INTERFACE 0x04) =11
0x00, //number defining this interface (IF we had more than one interface) ==12
0x00, //alternate setting ==13
1, //number of endpoints, except 0 ==14
0x03, //class code, 03 = HID ==15
0x01, //subclass code //boot ==16
0x02, //protocol code ==17
2, //number of endpoints, except 0 ==14
0xff, //class code, 03 = HID ==15
0xff, //subclass code //boot ==16
0xff, //protocol code ==17
0x00, //index of string descriptor for interface ==18
 
//class descriptor 1 (HID)
USB_DESC_CLASS_LEN, //length of descriptor ==19
/* USB_DESC_CLASS_LEN, //length of descriptor ==19
USB_DESC_CLASS_TYPE, //dscriptor type (0x21 == HID) ==20
0x00,0x01, //hid class release number (1.0) (try 1.10) ==21,22
0x00, //localized country code (0 = none) ==23
0x01, //number of hid class descrptors that follow (1) ==24
0x22, //report descriptor type (0x22 == HID) ==25
USB_CLASS_SPECIFIC_DESC_LOOKUP_SIZE[0][0], 0x00, //length of report descriptor ==26,27
0, 0x00, //length of report descriptor ==26,27
*/
//endpoint descriptor
USB_DESC_ENDPOINT_LEN, //length of descriptor ==28
USB_DESC_ENDPOINT_TYPE, //constant ENDPOINT (ENDPOINT 0x05) ==29
0x80, //endpoint number and direction (0x80 = EP0 IN) ==30
USB_ENDPOINT_TYPE_CONTROL, //transfer type supported (0x03 is interrupt) ==31
USB_EP0_TX_SIZE,0x00, //maximum packet size supported ==32,33
10 //polling interval, in ms. (cant be smaller than 10 for slow speed devices) ==34
 
//endpoint descriptor
USB_DESC_ENDPOINT_LEN, //length of descriptor ==28
USB_DESC_ENDPOINT_TYPE, //constant ENDPOINT (ENDPOINT 0x05) ==29
0x81, //endpoint number and direction (0x81 = EP1 IN) ==30
USB_ENDPOINT_TYPE_INTERRUPT, //transfer type supported (0x03 is interrupt) ==31
USB_EP1_TX_SIZE,0x00, //maximum packet size supported ==32,33
0x00, //endpoint number and direction (0x80 = EP0 IN) ==30
USB_ENDPOINT_TYPE_CONTROL, //transfer type supported (0x03 is interrupt) ==31
USB_EP0_RX_SIZE,0x00, //maximum packet size supported ==32,33
10 //polling interval, in ms. (cant be smaller than 10 for slow speed devices) ==34
};
 
230,7 → 181,7
USB_DESC_DEVICE_LEN, //the length of this report ==1
0x01, //the constant DEVICE (DEVICE 0x01) ==2
0x10,0x01, //usb version in bcd (pic167xx is 1.1) ==3,4
0xff, //class code ==5
0xff, //class code vendor specific
0x00, //subclass code ==6
0x00, //protocol code ==7
USB_MAX_EP0_PACKET_LENGTH, //max packet size for endpoint 0. (SLOW SPEED SPECIFIES 8) ==8