Thread: C language problem

  1. #1
    Registered User
    Join Date
    Feb 2017
    Posts
    3

    Post C language problem

    Hi. I have a few problems which really confuse me and I would appreciate it if you can help me out! Thank you!
    1) How can I set Port C bits 0,5 and 7 and clear all other bits in a C statement?
    2) Give a C statement that will configure Port C with the highest 3 bits as inputs and the other bits as outputs.
    3) What type of logic gate is used to select the rising or falling edge of a clocking signal?
    Last edited by Scarlett McKee; 02-01-2017 at 11:50 PM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,730
    What have you tried thus far? Note that most of your questions are actually not concerning C, e.g., you need to read your notes or the relevant manual.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Feb 2017
    Posts
    3
    really? I'm supposed to use a program named microchip

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,972
    > 1) How can I set Port C bits 0,5 and 7 and clear all other bits in a C statement?
    Do you know anything about bits?

    BitPos 76543210
    BitVal 10100001


    As for setting port C, you'd have to read your compiler / development environment / processor manual.
    It could be anything like these, or any variation on the same theme.
    PORTC = value;
    setport(PORTC,value);
    setPortC(value);
    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.

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    3,824
    Quote Originally Posted by Scarlett McKee View Post
    really? I'm supposed to use a program named microchip
    Find out what chip and find the Manual for that chip or chip family.

    Home | Microchip Technology Inc.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  6. #6
    Registered User
    Join Date
    Feb 2017
    Posts
    1
    1)Buddy.
    Your question is related embedded C.
    First of all search for your chip's reference manual.
    Then what compiler software you are using.
    Basically it is like,

    PORTC=0Xb10100001(if your port is 8 bit)

    Otherwise it depends on your compiler and chip.

    3) see how to select the rising and falling edge of a clock is generally mentioned in reference manual of chip.

  7. #7
    Registered User MacNilly's Avatar
    Join Date
    Oct 2005
    Location
    CA, USA
    Posts
    466
    What is "Port C"?

    Title of this post is bad, there is no "problem with C language".

    Sounds like a very hardware-specific question, with a misleading title.
    Last edited by MacNilly; 02-13-2017 at 04:06 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to do this? C language problem!?
    By worldwoo in forum C Programming
    Replies: 3
    Last Post: 03-10-2013, 07:22 AM
  2. a little c language problem...
    By anarcho in forum C Programming
    Replies: 4
    Last Post: 08-05-2010, 09:40 AM
  3. Problem with language conversion ... lol
    By cyreon in forum C# Programming
    Replies: 3
    Last Post: 09-14-2009, 02:40 AM
  4. mixed language problem
    By kes103 in forum Windows Programming
    Replies: 2
    Last Post: 01-23-2002, 01:26 PM

Tags for this Thread