Thread: Hey , I need some help .

  1. #16
    Registered User
    Join Date
    Jan 2012
    Posts
    12
    But I'm sure that it's C++ programming .

  2. #17
    Registered User
    Join Date
    May 2010
    Posts
    4,633
    From the first link in a Google search of MCC18.
    MPLAB C Compiler for PIC18 MCUs
    You are using a C compiler, a C compiler does not compile C++ code.

    Jim

  3. #18
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > I'm only stuck with writing the part whereas the temperature sensor can give me the temperature or data for me to use it .
    Really?

    I mean, you can already do something like attach your motor to your MCU board, and have written some software which reads say switch RB0 to move the motor one way, and reads RB1 to move the motor the other way.

    I'm not so sure you can do that already, since I don't think you've ever written a program for it before.
    You need to just practice writing programs which do simple things just on the board.
    - light RD0
    - light RD0 to RD2 in sequence
    - light RD0 to RD2 in "traffic light" order.
    - light RD0 if RB0 is pressed

    It's all about getting familiar with the tools,
    - how you use the editor to write code
    - how to use the compiler / linker / loader
    - how to get your program onto the MCU to begin with
    - how to figure out where it went wrong (you have NO debugger to help you here, no printf to report progress or anything).
    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. #19
    Registered User
    Join Date
    Jan 2012
    Posts
    12
    Quote Originally Posted by Salem View Post
    > I'm only stuck with writing the part whereas the temperature sensor can give me the temperature or data for me to use it .
    Really?

    I mean, you can already do something like attach your motor to your MCU board, and have written some software which reads say switch RB0 to move the motor one way, and reads RB1 to move the motor the other way.

    I'm not so sure you can do that already, since I don't think you've ever written a program for it before.
    You need to just practice writing programs which do simple things just on the board.
    - light RD0
    - light RD0 to RD2 in sequence
    - light RD0 to RD2 in "traffic light" order.
    - light RD0 if RB0 is pressed

    It's all about getting familiar with the tools,
    - how you use the editor to write code
    - how to use the compiler / linker / loader
    - how to get your program onto the MCU to begin with
    - how to figure out where it went wrong (you have NO debugger to help you here, no printf to report progress or anything).
    I have no trouble writing the part for motor cause mine is one way and I only need to send different voltage if the temperature is different . The light RD0 all , I've done it before . The only trouble I'm having is the AC to DC converter for the temperature sensor . I don't know how to get the figure out .

  5. #20
    Registered User
    Join Date
    Jan 2012
    Posts
    12
    Quote Originally Posted by jimblumberg View Post
    From the first link in a Google search of MCC18.

    You are using a C compiler, a C compiler does not compile C++ code.

    Jim
    Okay , I'm kinda confused . Now I don't know it's C programming or C++ programming .

  6. #21
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by Jun Wei Foo View Post
    The only trouble I'm having is the AC to DC converter for the temperature sensor . I don't know how to get the figure out .
    are you sure it's AC to DC? it would make more sense to be converting analog to digital.

  7. #22
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    The photo he posted for the sensor has an LM35 and what is likely an Op-amp on it.
    So, he likely needs to do analog to PWM.

    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

  8. #23
    Registered User
    Join Date
    Jan 2012
    Posts
    12
    Quote Originally Posted by Elkvis View Post
    are you sure it's AC to DC? it would make more sense to be converting analog to digital.
    Sorry . I think it's converting analog to digital .

  9. #24
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Jun Wei Foo View Post
    Okay , I'm kinda confused . Now I don't know it's C programming or C++ programming .
    Either it's using C.
    Or it's using C++.
    Two different languages. Very easy to tell them apart.
    Considering this is a C compiler, you will obviously be using C, and not C++.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed