To see this how it is meant to look, grab the text file from http://labby.co.uk/wp-content/uploads/2015/06/CodeBug-teardown.txt
Datasheet from http://ww1.microchip.com/downloads/en/DeviceDoc/30000684B.pdf
CodeBug teardown
CodeBug teardown PIC18F25K50-I/ML (28 pin QFN) pinout 2 2 2 2 2 2 2 8 7 6 5 4 3 2 1. 21 2 .\\ 20 3 19 4 18F25K50 18 5 -I/ML 17 6 140535K 16 7 15 8 9 1 1 1 1 1 0 1 2 3 4 1 RA2 8 RC0 15 RC7 22 RB4 2 RA3 9 RC1 16 Vss 23 RB5 3 RA4 10 RC2 17 Vdd 24 RB6 4 RA5 11 VUSB3v3 18 RB0 25 RB7 5 Vss 12 D- 19 RB1 26 !MCLR/Vpp/RE3 6 RA7 13 D+ 20 RB2 27 RA0 7 RA6 14 RC6 21 RB3 28 RA1 Datasheet recommendation: Connect bottom pad to Vss Pins by name: ID Pin Altfn Altfn Altfn Altfn Altfn Altfn Altfn Altfn Altfn Altfn Altfn Altfn Altfn Altfn Analog Compar CTMU SRLatch Refernc USB (E)CCP EUSART MSSP Timers Intrpts Pullup Basic ICD ================================================================================================================================ RA0 27 AN0 C12IN0- ================================================================================================================================ RA1 28 AN1 C12IN1- CTCMP ================================================================================================================================ RA2 1 AN2 C2IN+ VREF- DACOUT ================================================================================================================================ RA3 2 AN3 C1IN+ VREF+ ================================================================================================================================ RA4 3 C1OUT SRQ T0CKI ================================================================================================================================ RA5 4 Vss C2OUT SRNQ HLVDIN !SS ================================================================================================================================ RA6 7 OSC2 CLKO ================================================================================================================================ RA7 6 OSC1 CLKI ================================================================================================================================ RB0 18 AN12 SRI !FLT0 SDI INT0 Y SDA ================================================================================================================================ RB1 19 AN10 C12IN3- P1C SCK INT1 Y SCL ================================================================================================================================ RB2 20 AN8 CTED1 P1B INT2 Y ================================================================================================================================ RB3 21 AN9 C12IN2- CTED2 CCP2(1) SDO ================================================================================================================================ RB4 22 AN11 P1D IOCB4 Y ================================================================================================================================ RB5 23 AN13 T1G IOCB5 T3CKI(2) ================================================================================================================================ RB6 24 IOCB6 Y PGC ================================================================================================================================ RB7 25 IOCB7 Y PGD ================================================================================================================================ RC0 8 SOSCO IOCC0 T1CKI T3CKI T3G ================================================================================================================================ RC1 9 CCP2 IOCC1 ================================================================================================================================ RC2 10 AN14 CTPLS CCP1 IOCC2 P1A ================================================================================================================================ 11 VUSB3v3 VddCore ================================================================================================================================ 12 D- IOCC4 ================================================================================================================================ 13 D+ IOCC5 ================================================================================================================================ RC6 14 AN18 TX IOCC6 CK ================================================================================================================================ RC7 15 AN19 RX SDO(6) IOCC7 DT ================================================================================================================================ RE3(7) 26 Y !MCLR Vpp ================================================================================================================================ Note (1) Alternate CCP2 pin location based on Configuration bit. (2) Alternate T3CKI pin location based on Configuration bits. (6) Alternate SDO pin location based on Configuration bits. (7) RE3 can be used for digital input only (no output functionality). From the above table we can determine that: * The extension header connects to the PIC18F as follows: 1 CS to RA5 (!SS) 2 GND to Vss (Ground) 3 SDO to RB3 (SDO) 4 SCL to RB1 (SCL) 5 SDI/A to RB0 (SDI/SDA) 6 VCC to Vdd (Power) * The ICSP header connects to the PIC18F as follows: 1 !MCLR to RE3 (!MCLR) 2 Vdd to Vdd (Power) 3 Vss to Vss (Ground) 4 PGD to RB7 (PGD) 5 PGC to RB6 (PGC) 6 PGM to N/C (No connection) * The MicroUSB connector connects to the PIC18F as follows: 1 Power to Vdd (Power) 2 D- to 12 (D-) 3 D+ to 13 (D+) 4 ID to N/C (No connection) 5 GND to Vss (Ground) Looking now at the Blockly side of things, we can determine that connectors 0, 1, 2 and 3 are connected to port B (RB) as they can be set to pullup. If we consider that only 0, 2 and 3 can be made pullup I would conclude the following: * 0 to RB4 1 to RB5 2 to RB6 3 to RB7 This would make sense logically as it allows the ports to be handled in one block and fits with pin 1 not being able to be a pullup pin. I believe that the LEDs are connected in a row/column layout, with each row being turned on then turned off before moving to the next row. I am unsure at this point whether the rows are connected to RA and the columns to RC or vice versa. I am sure that the switches are on RA but unsure of the actual pins they connect to. This is because RC only has 5 pins available and all those would be taken up by the LEDs.
Top Comments