I'm having trouble . I couldn't figure out how to write a program to use temperature sensor to give out 3 different kinds of voltage to a motor . Could anyone guide me in this ? By the way , I'm using PIC18F4550 microchip in it .
Printable View
I'm having trouble . I couldn't figure out how to write a program to use temperature sensor to give out 3 different kinds of voltage to a motor . Could anyone guide me in this ? By the way , I'm using PIC18F4550 microchip in it .
There's not much chance of that without say a circuit diagram showing how your sensors and motor are wired to your PIC.
The circuits are basic type . Normal temperature sensor circuit and DC motor circuit .
Oh that's a relief then :rolleyes:
For a moment, I thought you had the sensor wired to pin2 rather than pin1
Shouldn't that sensor be on pin 3?
So how should I write the program ?
Well we could spend a few more days trying to tease every small fact about the problem using this method
Or you could read this and provide us with a decent amount of usable information about what you're actually using, what you're actually stuck on and what you've actually tried so far.
You are using nonstandard hardware, how are we to know how your sensors are connected to your board? You need to show us how your sensor is connected to your PIC (a schematic) , what kind of output your sensor provides. Also provide information as to who manufactured the sensor, along with model number. How manufactured the processor board and its model number would also be helpful. What compiler are you using?
Jim
ImageShack® - Online Photo and Video Hosting
ImageShack® - Online Photo and Video Hosting
Anyway I will be connecting the temperature sensor to portb .
schematic_MCT_board.pdf
this is the schematic of the PIC I'm using .
If you don't know what the hardware specifications are, you need to contact whoever gave you this project. Since you don't even seem to know the difference between C and C++ I doubt you will get very far with this project without serious hand holding. Good Luck.
But I'm sure that it's C++ programming .
From the first link in a Google search of MCC18.
You are using a C compiler, a C compiler does not compile C++ code.Quote:
MPLAB C Compiler for PIC18 MCUs
Jim
> 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 .
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.