18f43K20 timing woes

Status
Not open for further replies.
MrDEB, a few things...

Since you're using the intosc.bas module, remove
Code:
CONFIG fOSC = INTIO67 ' Internal oscillator, IO on pins 6 and 7
That's automatically handled by the intosc module for you, and it'll just confuse things when you change it later.
While you're at it, remove the duplicate 'INCLUDE "SetDigitalIO.bas"' statement.

Anyway, the IO setting of PORTA.6 and PORTA.7 have no effect on PORTC.6 and PORTC.7

but when the PIR2 TRIPS, THE PORTC.6 & 7 come on as well but not supposed to
I assume PORTC.6 and PORTC.7 are connected to your Green1 and Pwr_On LEDS? Which one is which?

There's more to your code than you're showing... how about posting the whole thing, and what you expect to happen with the HLVD module.
 
Jerry You wrote the IntOSC .bas Its nice work I was thinking it set's the whole ball of wax.
The sample shows how to use it Nice job.
Code:
device = 18F26K22
clock = 64

// optional - wait for intosc freq stable bit (the module defaults to not waiting)
'#option _INTOSC_IOFS_WAIT = true
include "intOSC.bas"
Rest of the gunk goes here
And a little more
Code:
device = 18F1320
clock = 8
include "IntOSC.bas"
include "USART.bas"
include "EEPROM.bas"
include "Convert.bas"

SetBaudrate(br19200)
Write("Program starting...",13,10)
while true
   Write("High",13,10)
   delayms(500)
   Write("Low",13,10)
   delayms(500)
wend
 
Well here is the whole enchilada at this point in time. The code is supposed to just monitor the battery condition but when the battery voltage goes down to 3.1 the yellow LOW Battery led comes on BUT portc.6 & 7 decide to come on as well.
Seriously thinking of eliminating the HLVD section but portc has no connections to portc ??
Have a second assembled board to test present code on,
 
MrDEB, do you ever proofread your posts after you click the button? You still don't get code tags (or you just refuse to indent to help people understand your code), and in the above case, you didn't even include the code you said you did. You expect people to take time to help you, but your can't even check to see that what you posted makes sense.
 
OUPS! my wife interrupted me
 
Isn't the else statement saying IF pin.x=1 then pin.x=1 - Looks kinda redundant. However, who knows how the hardware is wired.

This is Deja Vu all over again - had an almost identical discussion about 10 years ago.

Mike.
 
Isnt this that super duper mouse trap you built?

There was stupid me thinking you were trying to build a flashing led. i.e go back to basics and learn... Why does the led have to flash? low battery led on. Jonsea dont take this the wrong way, but your not helping, nothing will change until you change it.

Ok swordfish you dosnt make you read the datasheet, but i advocate reading them so people get how the chip works. In this case i would advocate Mr Deb comments all code by line then at the start and end of each block of code, i would insist he reads the codes and comments exactly what his block of code has done. He isnt going any other way, sorry but i dissagree with this kind of constant spoon feeding the same way i would to a healthy 12 year old still being fed on the boob.

I am not being nasty, actually i am trying to help as its starting to look like we are the problem not the solution. If this is that mouse trap, you aint half got some nerve Mr Deb
 
In my earlier days when I had a bug, I'd describe how the code worked to anyone (Teddy, coffee cup etc.) that would listen (or not). The act of describing how code works will (almost always) make you realise where the bug is. I believe this method is now called "Rubber Ducking".

Mike.
 
8MHZ is burning some juice for a battery powered mouse trap. why do you need that kind of speed? Ok its 4 cycles but that is still really fast for this kind of thing. Also........ok iwill shut up now
 
Causes problems Mike, i used to do that with my sister while she gurgled in her cot, now she wants access to my parts bin!! I didnt drink coffee then and didnt have a teddy!! Rod for my own back lol

Actually it was you who told me to indent ( i still dont get that!) and comment the code line by line to start with, i kind of comment blocks now but it works
 
for the umpteenth time...
Code:
Position1=1
Position2=1
Position3=1
Position4=1
Position5=1
Position6=1
Position7=1
Position8=1
Position9=1
Position10=1
You can't write to an input pin

Code:
Time1=1
Time2=1
Time3=1
Time4=1
You can't write to an input pin

Code:
   IF Position1 = 0 THEN
       TOGGLE(pLAYER1)
       DELAYMS(50)
   ELSE                                 // you can only get here if Position1 = 1 already, so there's no point in this ELSE code
       Position1 = 1                // anyway, YOU CAN'T WRITE TO AN INPUT PIN

Do you see a pattern? What do you expect to happen when you write to a pin that's set as an input?

It's nice after all this you're not even using the INTOSC.BAS module!
By the way, 'CLOCK=20' is invalid for the internal osc... intosc.bas would have told you this had you used it
 
Try and think of a input pin being a read pin and a output pin being a write pin. Great mouse trap BTW, i guess it took a while to slip in seeing as you declared to not only have made it better but it was working.

Any known issues with SF and win 8.1? my system refuses point blank to install it

Does anyone actually approve forum applications at SF? i joined 5-6 weeks ago and still not approved! Not even sure i can remember the name i used now lol
 
Last edited:
Any known issues with SF and win 8.1? my system refuses point blank to install it
I know others have installed it on win8.1 with no issues. Is this the full version or the free SE version?

Does anyone actually approve forum applications at SF? i joined 5-6 weeks ago and still not approved
Maybe try again, esp if you don't remember how you registered. I know new users have been approved as recent as May 1.
 
Its the free version, i also couldnt get the LCD character add on program to install, it said i needed a updated file that i clearly done, i even followed the link to download the MS files it wanted . Shame i cant find a simple program that walks me through using this.

Could be me however, i am so used to ARM and pics etc, and different IDE's, It gets confusing. I want to use the Junebug with SF
 
Jon found a typing error in post #50
as for writing to an input I am in error but then I am aware of what the pin is supposed to be. Will take the errors out.
Not using it?? INTOSC.BAS module! after I inserted it into the code the timing work great. Just need to adjust the button debounce as the Leds start blinking when pressing desired button
I will add explanations to each line of code. As for the ELSE statement in # 50, have seen this in lots of code examples. not really needed but.
I tested a second board and with the HLVD module activated, the portC. 6 & 7 are enabled when the PIR2.bits(2) = 1 trip point is 3.1 volts.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…