Using a compiler, (with this great site, no need to help you there).
Try this code for a process, just change the #include on line 1 for your device.
This example of coding technique is quite excelent from a professional point of view, I am sure of that !!.
Many comments within to explain, Please Read through the code. Do have fun with the knobs.
Hope your coding days will evolve as mine has through the years. I will try to be here more often for questions.
Caveman
PS. It worked in comepiled version.
int16 isr_10m_your_delay; // this is a GLOBAL variable (16 bits), with a name given // The next line controls the timing #define YOUR_10M_DELAY_TIME 100 // CHANGE FROM "100" to suit your needs. // Here is the "reading" of many books part. ahh.. , I will leave that up to you, , The Powerful Interrupt void ISR_TIMER0()using 5 as 2{ set_timer0( 15535 ); // reload timer for 10 mS, just simple math.. pre-scaler setting and this count if (isr_10m_your_delay) isr_10m_your_delay --; // decrement if NOT zero this time of the interrupt } void main(void) { setup_timer_0( RTC_INTERNAL | RTC_DIV_2 ); // get TMR0 initialized for the time base enable_interrupts( INT_TIMER0 ); // Allow the INT from TMR0 enable_interrupts( EA ); // Allow Interrupts, without EA, never an Int at all // Initialize the delay isr_10m_your_delay = YOUR_10M_DELAY_TIME; for ( ;; ) { if ( isr_10m_your_delay == 0 ) { // Pick your pin in the physical realm output_toggle(PIN_P2.34); // CHANGE ME FROM "PIN_B4" // Re-Initialize the delay isr_10m_your_delay = YOUR_10M_DELAY_TIME; } } }
"It worked in comepiled version."
No, it didn't.
hi mate,
you tryed and gt error ???? where you have the error????
i Will Fix it For you.
"where you have the error????"
For starters, here:
int16 isr_10m_your_delay;
And here:
void ISR_TIMER0()using 5 as 2{
set_timer0( 15535 );
setup_timer_0( RTC_INTERNAL | RTC_DIV_2 );
enable_interrupts( INT_TIMER0 );
enable_interrupts( EA );
output_toggle(PIN_P2.34);
you have some errars. you forgat to Change the #include on line 1 for Your Device and i Think.
There isn't an #include on line 1 to change.
hi m8,
you saw my mistake!!!!
it Was
#include "C:\\my projects\\project 128923\\verison 28\\heders\\headar.h"
you must change it For you r Project please.
"you must change it For you r Project please."
I changed the #include for my device. I still get the first error:
FOO.C(3): error C129: missing ';' before 'isr_10m_your_delay'
try changin foo.c to sample82.c like i got
"try changin foo.c to sample82.c ..."
The same error:
SAMPLE82.C(3): error C129: missing ';' before 'isr_10m_your_delay'
hi agian m8,
i think you must chek for ; before.
did u copy my code well?
"i think you must chek for ; before."
Before what; the first line of your program?
"did u copy my code well?"
I used the operating systems copy/paste feature to copy your code exactly and then modified it like you said (well, "added" actually, since you had forgotten the #include line) for my project resulting in sample82.c:
#include <reg52.h> int16 isr_10m_your_delay; // this is a GLOBAL variable (16 bits), with a name given // The next line controls the timing #define YOUR_10M_DELAY_TIME 100 // CHANGE FROM "100" to suit your needs. // Here is the "reading" of many books part. ahh.. , I will leave that up to you, , The Powerful Interrupt void ISR_TIMER0()using 5 as 2{ set_timer0( 15535 ); // reload timer for 10 mS, just simple math.. pre-scaler setting and this count if (isr_10m_your_delay) isr_10m_your_delay --; // decrement if NOT zero this time of the interrupt } void main(void) { setup_timer_0( RTC_INTERNAL | RTC_DIV_2 ); // get TMR0 initialized for the time base enable_interrupts( INT_TIMER0 ); // Allow the INT from TMR0 enable_interrupts( EA ); // Allow Interrupts, without EA, never an Int at all // Initialize the delay isr_10m_your_delay = YOUR_10M_DELAY_TIME; for ( ;; ) { if ( isr_10m_your_delay == 0 ) { // Pick your pin in the physical realm output_toggle(PIN_P2.34); // CHANGE ME FROM "PIN_B4" // Re-Initialize the delay isr_10m_your_delay = YOUR_10M_DELAY_TIME; } } }
And this is the error:
hi m8e,
yes you havre a prolblem still and i think you must chek your' code agian .!!!!
do not worry if you donot understand the code. plz read teh comment and learn from proffesionals.
plz ask to more questeons.
"yes you havre a prolblem still and i think you must chek your' code agian .!!!!"
You misunderstand. That is the code in its entirety. It is your code, not my code.
Your code is broken. WHY?
sorrey m8e,
i canot do to much time on you.
the error said u missed ; so u must put it in.
i Think you copied the code bad?????!!!!!
try controlc and controlv insted.
try chaning the