Some are dark brown. Some even have writing on them - I wonder what this one is?
Another clueless student trying to fudge a class project by the looks of it.
Some are dark brown. Some even have writing on them - I wonder what this one is?
Another clueless student trying to fudge a class project by the looks of it.
Yes it's 16F88 .. and it's 18pin... BLACK in color comes with some wording on top of it!! but I use my finger's to rub it off anyway.. and now it's unknown chips , so I put DIL18
Thanks mat janssen , this is what I've done first... I'm sure somewhere must have coded wrongly.. I'll check tonite again!
Thanks!
Something like this is where LOOKUP2 comes in handy.
Change the delay periods in the table to suite your app.Code:@ DEVICE PIC16F88, WDT_OFF,INTRC_OSC,MCLR_OFF,BOD_ON,LVP_OFF,PWRT_ON,PROTECT_OFF DEFINE OSC 8 DEFINE NO_CLRWDT 1 OSCCON = %01110000 ' 8MHz CMCON = 7 ' disable analog comparators ANSEL = 0 ' disable A/D module, all digital X VAR WORD Index VAR BYTE LED VAR PORTB.0 TRISA = %00111100 ' RA2 to RA5 inputs for DIP switch PORTB = 0 TRISB = %11111110 ' RB0 for LED OPTION_REG = %11111111 WHILE OSCCON.2 = 0 ' wait for internal osc stable before moving on WEND Main: Index = (PORTA >> 2) & $0F ' Read DIP switch AND mask result LOOKUP2 Index,[200,300,400,500,600,700,800,900,1000,2000,_ 3000,4000,5000,6000,7000,8000],X HIGH LED PAUSE X LOW LED PAUSE X GOTO Main END
Thanks Bruce!
your code helps alot, and it looks much simpler then what I've done... thanks again!
Hi Bruce,
If I get this right . . translates to portA / 4 & %00001111 , what I do not get is what it means, are we doing math here to get a number ??? & = AND. What does it mean, Mask result?Code:Index = (PORTA >> 2) & $0F ' Read DIP switch AND mask result
I am really trying to get my head around how this works, because it works pretty sweet, Thanks
JS
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
The OP show switch connected on RA<5:2>
>>2 : yes it's divide by 4... but also easier to figure out when you use the 'Shift it 2 positions to right' term. Here it will shift the whole PORTA reading, 2 bits to the right... hence remove PORTA<1:0>
the & $0F is indeed a Bitwise AND. This way it keep only bits <3:0>... here PORTA<5:2> once shifted to the right.
Code:76543210 Index= %10101111 Index=Index >>2 ' now %00101011 Index=Index & $0F ' now %00001011
Last edited by mister_e; - 16th January 2008 at 07:25.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Thank You Mister_e,
I will have to think on this awhile, but I see it throws out the 2 LSB and then throws out the 4 MSB, seems odd, I just have to get my thick head around it. Would it be possible to use say PortB and use only 4 ports in BCD fashion while using the rest as outputs? Something like
Index = PORTB<3:0>?
Thanks
JS
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks