From the Data sheet: ANSEL and ANSELH must be configured to use port C as I/O.
Without them sound works on PortB but not PortC, the code snippet above is configured to use the MicroChip low parts count demo board.Code:;@MyConfig = @MyConfig = _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON @MyConfig = MyConfig & _MCLRE_ON & _BOR_OFF @ __config MyConfig DEFINE OSC 4 PortA = 0 PortB = 0 PortC = 0 TRISA = 1 TRISB = 0 TRISC = 0 i var byte ANSEL = 0 ANSELH = 0 CM1CON0 = 0 CM2CON0 = 0 main: portc = 0 pause 500 for i = 1 to 15; step -1 portC = i i=i << 1 pause 250 next i sound portB.6, [120,2,124,2,123,2,121,2] sound portC.6, [120,2,124,2,123,2,121,2] goto main end




Bookmarks