Bracer New Member Aug 15, 2010 #1 This is the Code in PICBasic Pro: @ DEVICE pic16F628A, INTRC_OSC_NOCLKOUT 'Use Internal Clock Input PortA.0 'Makes Port A, Pin 0 an Input. Routine: If PortA.0 = 1 Then High PortB.0 Sound PortB.7, [120,15] endif Goto Routine I don't understand why it doesn't react when PortA.0 IS high
This is the Code in PICBasic Pro: @ DEVICE pic16F628A, INTRC_OSC_NOCLKOUT 'Use Internal Clock Input PortA.0 'Makes Port A, Pin 0 an Input. Routine: If PortA.0 = 1 Then High PortB.0 Sound PortB.7, [120,15] endif Goto Routine I don't understand why it doesn't react when PortA.0 IS high
Nigel Goodwin Super Moderator Most Helpful Member Aug 15, 2010 #2 You need to disable the analogue comparators, they are ON by default.
Bracer New Member Aug 15, 2010 #4 Yes! CMCON = 7 Thank you lilimike & Nigel Goodwin. lilimike...why "CMCON = $07" ? What's with the "$0" ? Thanks
Yes! CMCON = 7 Thank you lilimike & Nigel Goodwin. lilimike...why "CMCON = $07" ? What's with the "$0" ? Thanks
lilimike Member Aug 15, 2010 #5 The $ means the value is hexadecimal, you can also use % for binary or simply 7 for decimal. Of course 7 = 07 but since I used HEX I always use 2 digits which are from $00 to $FF Its just a programming habit. Mike Last edited: Aug 15, 2010
The $ means the value is hexadecimal, you can also use % for binary or simply 7 for decimal. Of course 7 = 07 but since I used HEX I always use 2 digits which are from $00 to $FF Its just a programming habit. Mike
Bracer New Member Aug 15, 2010 #6 So a hexadecimal = decimal ? because I tried CMCON = 7 and it works perfectly. If $07 = 7, why would people use hex at all ? Just use decimal all the way ?
So a hexadecimal = decimal ? because I tried CMCON = 7 and it works perfectly. If $07 = 7, why would people use hex at all ? Just use decimal all the way ?
lilimike Member Aug 15, 2010 #7 Hexadecimal from 0 to F 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F Decimal from 0 to 15 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 As you can see both count up to 15 and both are equal up until 9 You will get a good explanation HERE with a comparison betwen HEX, DEC and Binary Mike
Hexadecimal from 0 to F 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F Decimal from 0 to 15 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 As you can see both count up to 15 and both are equal up until 9 You will get a good explanation HERE with a comparison betwen HEX, DEC and Binary Mike
J Jon Chandler Banned Aug 15, 2010 #8 A good reference covering many problems in making PICs run is here: Commandments for Using PICs
A amando96 Guest Aug 15, 2010 #9 The first 9 numbers of HEX are just like HEX, to convert it mentally you also have to know binary(at least the way I do it).
The first 9 numbers of HEX are just like HEX, to convert it mentally you also have to know binary(at least the way I do it).
J Jon Chandler Banned Aug 15, 2010 #10 Commandments for Using PICs talks about some often overlooked issues that frequently cause problems.