HankMcSpank,
I think the 'F690 is going to be my next favorite PIC. It has SO MUCH STUFF on it!
In other words, not a beginner PIC ( like the 16F628, F648, F87, F84(old and gray) )
There are ALOT of registers to learn how to use on this chip.
NOTE: something that used to trip me up when reading data sheets:
when you "SET" a value you change it to "1"
when you "CLEAR" a value you change it to "0"
so that if someone says "set the flag", it means to ONE, (1), HIGH
I only bring this up because you are new. The M-chip data sheets use this nomenclature all the time.
Also NOTE: The 16F690 Datasheet is your new best friend. All 306 pages, WOW. You might want to print out the pages with
the register descriptions for each "feature" so you know what CM1CON0, etc means. Adobe pages 34-37 are best. Also,
under the feature headings are listed all relevant registers that need to be set/cleared, usually near the end.
You might need to set ( or CLEAR) the following registers as well (some required in other PICs):
'Registers:
ANSEL = %00000000 ' clears the individual bits that select analog inputs (low register)
ANSELH = %00000000 ' clears the individual bits that select analog inputs (high register)
VRCON = %00000000 ' turns the Vref Module OFF by CLEARING bit7, 6, 4
'I use the binary format so I can easily set them later. I know it seems redundant when they are all 0's, but later....
'Bits Only:
CM1CON0.7 = 0 ' turns Comparator1 OFF by CLEARING bit7
CM2CON0.7 = 0 ' turns Comparator2 OFF by CLEARING bit7
ADCON0.0 = 0 ' turns the AD Converter OFF by CLEARING bit0
INTCON.0 = 0 ' clears the RABIF Flag (to 0), COULD be 1 on reset (unique to F690)
RCSTA.7 = 0 ' clears the SPEN bit ( SETTING SPEN DISABLES RB7 AS GENERAL PURPOSE! )
'note that there is an Errata Datasheet that mentions issues with SPEN, but only when using the Serial Hardware
'you might HAVE TO do this after clearing ANSEL/ANSELH
PORTA = %00000000 ' Clear the port register latches
PORTB = %00000000
PORTC = %00000000
TRISA = %11111111 ' Set or Clear the data direction registers
TRISB = %11111111
TRISC = %00000000
'FOR EXAMPLE: On the F628 and friends, you only need:
'CM1CON = 7 ' turns the comparators OFF by SETTING bits 0,1,2
'and the Port/Tris settings
'OK, now on to your code...
'The Button Command:
BUTTON 7, 0, 255, 0, B0, 1, Loop
'"7" is not a pin name.
'For buttons and LEDs, I use names like btnStart or btnUp, LEDFault, LEDStatus.
'But sometime I use PHYSICAL pin numbers on new chips that I'm learning. So try :
RB7pin10 VAR PortB.7
'I wouldn't use the term B0 as a variable, it is used so many other places (mainly STAMP) to denote PortB.0. Try:
Temp VAR BYTE
'Also, for the Jump To label you use "Loop", but I don't see it in your listing. Maybe you meant "Next", but you can't use that name.
'So Now:
Start:
LED1 = 0
Button RB7pin10, 0, 255, 0, Temp, 1, Blink
GOTO Start
Blink:
LED1 = 1
Pause 1000
GOTO Start
End
'I'm not at work so I can't test this until tomorrow.![]()
Bookmarks