Struggling in programming pic18f452

This is a discussion on Struggling in programming pic18f452 within the C++ Programming forums, part of the General Programming Boards category; Hi everyone , Can u pls help me programming pic18f452 using C code , I need to send 40 victors ...

  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
    1,625
    What have you tried so far?
    Devoted my life to programming...

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,541
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    2,577
    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 02: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-08-2008, 11:23 PM
  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, 03:40 PM
  5. struggling with linked lists
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 01-31-2002, 06:01 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21