Thread: Struggling in programming pic18f452

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    3

    Smile Struggling in programming pic18f452

    Hi everyone , Can u pls help me programming pic18f452 using C code , I need to send 40 victors to pic ports, e.g ( 20080) where, 2=port A , 0=port B , 0= port C , 8= port D , 0= port E. Delay for 3 second and send another different vector till all 40 vectors or commands finished. Looking forward to hearing from any one. Thanks in advance

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    What have you tried so far?
    Devoted my life to programming...

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    In particular, have you tried to send just ONE thing to ONE port?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Steps
    1. Learn which C Compiler you are using
    Note: Microchip C18, Hi-Tech C, and a few others; each use a slightly different time delay setup.
    2. Learn to use simulation in MPLAB IDE (watching the ports value is real important)
    Note: Common Mistake forgetting to set the proper speed of MCU.
    3. Write a program that outputs a single byte to a port
    Note: Common Mistake not setting up port to be a output.
    4. Find out how to do a time delay
    Note: Are you going to use a routine supplied by the Compiler or write your own using hardware interrupts.
    Note: I would NOT recommend that you write your own.
    Note: If compiler supplied delay, you are likely to need to wrap it in a for loop since most compiler delays are for only fraction of seconds max.
    5. Write a program that outputs a second byte to a port after waiting the delay time.
    6. Create an constant array of 40 bytes needed for the port
    6B. use a for loop to increment though the array.
    7. Create the other arrays one per each port
    8. Program the real MCU; instead of using Simulator

    Tim S.
    Last edited by stahta01; 11-19-2010 at 03:28 PM.

  5. #5
    Registered User
    Join Date
    Nov 2010
    Posts
    3
    Thanks Tim S, that was good advice , I will try to follow that.

  6. #6
    Registered User
    Join Date
    Nov 2010
    Posts
    3

    shift a bit through a byte

    Hi all, I am trying to learn programming pic 18f452 , can any one help in writing code to shift a bit through a byte? and how can I do that separatly with each port, thanks in advance.

  7. #7

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Struggling with Reverse of String
    By dnguyen1022 in forum C Programming
    Replies: 11
    Last Post: 12-09-2008, 12:23 AM
  2. Still struggling with sorting a singly linked list
    By jou00jou in forum C Programming
    Replies: 3
    Last Post: 03-13-2008, 11:07 AM
  3. Replies: 4
    Last Post: 10-14-2005, 12:53 PM
  4. Struggling with using a class from one .cpp in another .cpp file
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 02-21-2002, 04:40 PM
  5. struggling with linked lists
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 01-31-2002, 07:01 AM