help me please in mikro c programmation

Status
Not open for further replies.

moumenemou

Newbie level 4
Joined
Apr 2, 2017
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
45
hi in my project, i will control un stepper motor varie Using a temperature sensor by pic16F877A (MIKRO C AND PROTUS ISIS). For example, if I have a temperature rising from 0 to 150 ° C, the motor must be running in steps.
My problem i am looking for a program by micro c which
Plzzzzzzzzzzzzzzzzzzzzzzzzzz This is an end-of-study project
 

You have to change the delay value between steps signals and to do this in mikroC you have to use

Code:
VDelay_ms();

function.

Raw adc value of 0 to 1023 (10 -bit) is converted to say 100ms to 2ms range and used in VDelay_ms() function.

Another way to do it is to create a timer interrupt of say 1ms and then use a counter in the Timer Interrupt ISR and increment it to get the required delay count based on the raw adc value and then provide the required step signals in the Timer ISR itself. This will be non-blocking code.
 

hi

first you need to clarify following things
1) whether increase in temperature has any relation with speed of stepper motor (i.e if temperature increase speed increase or vise versa), or your stepper motor has fixed
speed.
2) half step or full step configuration or any other config
3) how precise you temperature need

depending on that you can start writing code.
few steps to start i will suggest below

Code:
   #include<header_file_of_mcu.h
  
    main()
   {
         initialise_adc();  // init your adc channel here
         initialise_stepper motor();   // init port to interface stepper motor
         initialise_timer();  // init your timer for 5 ms say for adc scanning depend upon scan rate
         initialise_timer1();  // init your some other timer for pwm to drive motor

        while(1)
        {
        }
}
//this should be your general structure

- - - Updated - - -

for driving simple stepper motor you can try this for initial trials


1. CMCON = 0x07; // To turn off comparators
2. turn off analog to digital converters for that port you wanted to interface stepper motor so they will work as digital I/O
3. make that PORT as output port
4. send full wave sequence PORT_to be used = 0b00000011;
5. then some delay Delay_ms(500);
6. PORT_to be used = 0b00000110;
7. Delay_ms(500);
8. PORT_to be used = 0b00001100;
9. Delay_ms(500);
10. PORT_to be used = 0b00001001;
11. Delay_ms(500);
keep this sequense (from 4- 11) in while loop

but using delay is not at all good practice , telling you this steps to initially atleast making stepper motor work , you can do this via using timer as PWM or using timer inturrupt .

for ADC you need to have proper circuit like which temperature sensor your using ? whats sampling rate etc.
if you provide complete detail it will be helpfull.
 

hi
what exactly you need , temperature controller program or stepper motor ? there are many example you can find online
even with our this forum you can have some info
below is the link
https://www.edaboard.com/threads/62300/



https://www.youtube.com/watch?v=0Cnc_MzOzqc this is the model of stepper motor that i chose(the idle aire control valve but run with a capteur tempurature LOOK THIS https://www.youtube.com/watch?v=2GdVfqa2XRQ&app=desktop

- - - Updated - - -

ok but i don't know how programmer the sensor tempurator as this https://www.youtube.com/watch?v=2GdVfqa2XRQ&app=desktop
 

Timer Interrupt has to be used to provide pulse sequence to stepper motor.

1. What will be the max engine temperature ?
2. What temperature sensor are you going to use ?
3. If external oscillator then what will be the Crystal frequency ?
4. How will you map engine temperature to stepper motor delay ?
 


1the max100C
2/LM35
3/20MHZ
4 tempurator increasemotor turn in in the sens right when tthe tempurator decrease turn in the left
 

1the max100C
2/LM35
3/20MHZ
4 tempurator increasemotor turn in in the sens right when tthe tempurator decrease turn in the left

hi
ok as I understand you need to turn stepper motor clockwise and when tempereture decrease it turns anticlockwise is it?
what will be RPM of stepper motor? it will remain fixed am I correct?

can you please tell me on which PORT pin your connected your LM35?
also on which port your thinking to interface stepper motor?

for temperature you need to configure one ADC pin to which you will be connecting LM35, if you specify port pin we can go further
 



1/yes this is
2/yes is fixed
3/the LM35 is porte A and motor porte B
give me simulation proteus of all as you like , you can؟؟؟
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…