PDA

View Full Version : Help Required for Newbie



Moz
- 11th August 2004, 01:31
Hi all,
After some help tried everything but nothin seems to work !!

I have a development board with 6 led's RB0 - RB5 and 4 switches connected to RA0-RA3. Can do all sorts with RBx outputs but nothing with the switches on RAxx.

The switches go high to the pic when pressed as verified with a scope.

The PIC is 16f627 I have set PORTA to digital using the statement CMCOM=7

Also the button command does not seem 2 work either.

Starting to lose the plot with this - any help would be greatly appreciated. The compiler is Micro engineering labs pic basic pro ver 2.42

guess all i want 2 do is read ra0 if high switch on rb0 etc etc cant be hard can it

Thanks

Moz

NavMicroSystems
- 11th August 2004, 01:51
Moz,

you have probaly just mistyped it

it should read CMCON not CMCOM

If you post your code we will certainly be able to help.

What does your hardware setup look like?

You say portbits are going high when the button is pressed.
That sound like you have a switch between Vdd and the PIC-pin.
This would mean the PIC-pin is floating when the switch is open.
(Or are there PullDown resistors?)

regards

Moz
- 11th August 2004, 03:02
Yep that was a mistype sorry OK hardware looks like this the board im playing with is a velleman kit K8048 and has the following.

RB0 to RB5 via a 680R to GND this all works can toggle set output high etc.

And RA0 to RA3 connected to 10K pull down rersitors with the other side of the switches tied to 5v supply rail - so the PIC input is usually low but goes high when the switch is pressed.

Many thanks for your help so far

Regards,

Moz

Darrel Taylor
- 11th August 2004, 11:09
Hi Moz,

Are you using the bootloader program PROGPIC2.exe that comes with the K8048?

If so, did you include the...

   DEFINE LOADER_USED 1

statement in your program. If it's missing, it can cause some very strange problems.

Do you have a 16F627 or a 16F627A ?? Make sure that the selected device in the programmer matches the chip you are using.

And, make sure there aren't any chips in the other sockets (8pin, 14pin or 28pin)

HTH,
   Darrel

Moz
- 12th August 2004, 00:32
Hi Darrel,

No I was not using the DEFINE LOADER_USED 1 statement and yes I am using the PROGPIC2.exe that comes with the K8048?

Definately the 16f627 device and no other chips in situ.

The compiler is PB Pro with CD Lite as a front end.

Still does not work though - Should I go back to C programming and 8051's lol


Many Thanks


Moz

NavMicroSystems
- 12th August 2004, 01:26
Darrel,

is there a Loader for the 16F627 ???

Moz,

If you post your code we'll have a look at it.
All we can do without the code is just guessing.

regards

Darrel Taylor
- 12th August 2004, 10:08
>> is there a Loader for the 16F627 ???

Nope, apparently not.

Velleman fooled me by using the serial port to program the chips.
Apparently they are using the RTS and DTR signals to program it with normal ICSP. I guess it would be hard to have a bootloader for a chip that doesn't have a EEPGD bit in EECON1 register.

Which brings us back to Moz.
There's so little that could go wrong here. Post your code, it's got to be something simple.

Darrel

Moz
- 13th August 2004, 01:05
After some playing managed to get it all working now - operator error im afraid I did not think to check the target device in the programmer drop down box..... wrong device - lol.

Thanks to Darrels comments about the progpic2.exe this pointed the finger of suspicion.

It makes a difference even though i was compiling using the -p16f627 switch on the compiler command line, progpic2 had other ideas.

Hopefully I can now get on to what I need to do which is measure low frequencies below 250Hz accurately - any ideas here would be most welcome

Once again - many thanks

Moz