Forum Replies Created
-
AuthorPosts
-
Ligo GeorgeKeymasterLigo GeorgeKeymaster
Sorry I don’t understand your CopyConst2Ram(). You can use the following function for that.
char* CopyConst2RAM(const char* ctxt) { static char temp[20]; char i; for(i =0; temp[i] = ctxt[i]; i++); return txt; }
Ligo GeorgeKeymasterYou may use voltage dividing resistors and/or 5.1V zener diode to reduce the sensor output voltage down to 5.1V.
Ligo GeorgeKeymasterI can’t find any problems in the above code.
What about the entire code ? Is it too lengthy ?
Make sure that free RAM is above 30% otherwise it may cause such issues.
Ligo GeorgeKeymasterSorry, I don’t have any circuit or tutorials for interfacing inductive proximity sensors. Which sensor you are using ?
Ligo GeorgeKeymasterI think the problem is with type of switch you are using. You should use a micro switch, which will return to OFF state after the press. If you want to use ON – OFF switch you can add while(PORTD.F0 == 0); at end of if loop.
Ligo GeorgeKeymasterSorry, I don’t understand what you are telling. The above program will check the sensor input only when you press the push button switch. It will not give any output without pressing of switch.
Ligo GeorgeKeymasterAs long as RD0 = 0 and RD1 = 1 the sequence will repeat continuously as per the above program.
Ligo GeorgeKeymasterAre you sure that you are using push switch ?
If you are using push switch, the sequence will not repeat without pressing of switch.
Most of the microcontroller programs requires infinite loop as it needs to continuously read sensor status, switch status etc.
Ligo GeorgeKeymasterPlease post the code or AT command used to send this sms.
Ligo GeorgeKeymasterYou may use it like matrix keypad. Use 6 pins of PIC as inputs such that you can connect 24 x 6 = 144 switches.
Ligo GeorgeKeymasterIt seems like the the program is correct as per the logic explained by you. You can use L298N, if you need more current.
Ligo GeorgeKeymasterFirstly, above code is for MikroC Pro compiler. You can reduce the voltage of Proximity Sensor using Voltage dividing resistors and/or zener diode.
Continuous pressing of switch is not required, it depends on how you program (how many times you read switch) etc.
Ligo GeorgeKeymasterJust read the above tutorials carefully, you can do it yourself. You can connect two switches to any of the IO pins of PIC Microcontroller. You can make those pins Input by writing to TRIS register. Similarly you can connect L293D inputs to 2 outputs of MCU and make those pins Output by writing to TRIS register.
Ligo GeorgeKeymasterHi, the following variable microsecond delay functions will work with enough accuracy if you use clock 20MHz or more.
For PIC 16Fvoid Vdelay_us(unsigned time_us) { unsigned ncyc; ncyc = Clock_MHz()>>2; ncyc *= time_us>>4; while (ncyc--) { asm nop; asm nop; } }
For PIC 18F
void Vdelay_us(unsigned time_us) { unsigned ncyc; ncyc = Clock_MHz()>>2; ncyc *= time_us>>4; while (ncyc--) { asm nop; asm nop; asm nop; } }
-
AuthorPosts