Help Required for Newbie


Closed Thread
Results 1 to 8 of 8
  1. #1
    Moz's Avatar
    Moz Guest

    Smile Help Required for Newbie

    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

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    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
    Last edited by NavMicroSystems; - 11th August 2004 at 00:56.

  3. #3
    Moz's Avatar
    Moz Guest


    Did you find this post helpful? Yes | No

    Default Hi Nav

    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

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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

  5. #5
    Moz's Avatar
    Moz Guest


    Did you find this post helpful? Yes | No

    Unhappy Thanks Darrel

    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

  6. #6
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    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

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    >> 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

  8. #8
    Moz's Avatar
    Moz Guest


    Did you find this post helpful? Yes | No

    Talking Thanks all for your help

    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

Similar Threads

  1. Long variables. Information required.
    By timmers in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th November 2009, 10:17
  2. Is MPASM required for lcd anypin?
    By mel4853 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th June 2009, 01:21
  3. 16F819 - Pullup on MCLR required?
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 22nd December 2005, 17:52
  4. PIC to PIC, How Many IO Connections Required?
    By CocaColaKid in forum Serial
    Replies: 4
    Last Post: - 1st September 2005, 17:16
  5. Help Required
    By lester in forum Forum Requests
    Replies: 2
    Last Post: - 19th July 2003, 22:16

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts