New Knight rider Flasher
Re: New Knight rider Flasher
Smthing has gone wrong
anyway gd wrk Rksk
Re: New Knight rider Flasher
Thank you.Thank you.RAT16F88 wrote:
Smthing has gone wrong
anyway gd wrk Rksk
Have you the code for your posted video?
[ Post made via Mobile Device ]
Re: New Knight rider Flasher
Yours seems a bit slow to me. If you have used a 4MHz oscillator as in RAT's diagram, only thing I can guess is that your Oscillator setting in code. Try these.Where is the wrong? does RaT lie?
- Normally in delay.h, you have #define PIC_CLK 4000000 //4Mhz so that the delay routines work correctly.
You can use attached Delay routines and see whether that fix the problem. Edit: Changed the PIC_CLK to 4MHz - If (1) doesn't seem to fix your problem, Insert this line on top of main() (if you are using HITECH C compiler).
Edit: Use HS for 8MHz and 16MHz (XT for 455KHz, 2MHz and 4MHz)
Code: Select all
__CONFIG( XT & WDTDIS & PWRTDIS & BORDIS & LVPDIS & WRTEN & DEBUGDIS & UNPROTECT );
- If both (1) and (2) are not working, adjust the delay routines until you are satisfied. Just reduce the values (at present it is set to 300)
Last edited by Neo on Tue Aug 30, 2011 7:00 pm, edited 3 times in total.
Reason: Adjusted the delay.h to be 4MHz
Reason: Adjusted the delay.h to be 4MHz
Re: New Knight rider Flasher
It's correct, my my one has a speed problem & your solution corrected it.Neo wrote:Yours seems a bit slow to me. If you have used a 4MHz oscillator as in RAT's diagram, only thing I can guess is that your Oscillator setting in code. Try these.Where is the wrong? does RaT lie?
- Normally in delay.h, you have #define PIC_CLK 4000000 //4Mhz so that the delay routines work correctly.
You can use attached Delay routines and see whether that fix the problem. Edit: Changed the PIC_CLK to 4MHz- If (1) doesn't seem to fix your problem, Insert this line on top of main() (if you are using HITECH C compiler).
Edit: Use HS for 8MHz and 16MHz (XT for 455KHz, 2MHz and 4MHz)Code: Select all
__CONFIG( XT & WDTDIS & PWRTDIS & BORDIS & LVPDIS & WRTEN & DEBUGDIS & UNPROTECT );
- If both (1) and (2) are not working, adjust the delay routines until you are satisfied. Just reduce the values (at present it is set to 300)
But my problem is not that. RaT's video's LEDs runing with a tail. But my video is not that, it's style is completly difference one. Watch both of videos carefully.
Thank you.
[ Post made via Mobile Device ]
Re: New Knight rider Flasher
Honestly I don't see any difference other than the speed. I guess the effect you see is due to the LEDs RAT has used and dark light on the video. May be my eyes are getting old just as meBut my problem is not that. RaT's video's LEDs runing with a tail. But my video is not that, it's style is completly difference one. Watch both of videos carefully.
Re: New Knight rider Flasher
Hmm...
Ho do I explain this???
RaT' Video - All the LEDs are lighted never!
My video - All the LEDs are lighted for two time in a cyle.
Thank you.
[ Post made via Mobile Device ]
Ho do I explain this???
RaT' Video - All the LEDs are lighted never!
My video - All the LEDs are lighted for two time in a cyle.
Thank you.
[ Post made via Mobile Device ]
Re: New Knight rider Flasher
You are correct. Obviously RAT was running a modified version. There should be two points where you will see all the LEDs light up according to the logic submitted in the first post.RaT' Video - All the LEDs are lighted never!
My video - All the LEDs are lighted for two time in a cyle.
Re: New Knight rider Flasher
According to what I see, RAT only light up 4 LEDs at a time.
I was thinking to write a simplified logic for fun Write the most optimised code (in C and ASM) is like my best hobby. when you also try on that, I'm sure you'll get lots of fun out of it.
Rksk, can you try these codes and let me know? Since I haven't either compiled them or run them, there can be issues (I don't have access to a PIC at the moment).
If the above logic is complicated for you, try out the following one. Then I'm sure you'll be able to go for the first one which is more compact.
I was thinking to write a simplified logic for fun Write the most optimised code (in C and ASM) is like my best hobby. when you also try on that, I'm sure you'll get lots of fun out of it.
Rksk, can you try these codes and let me know? Since I haven't either compiled them or run them, there can be issues (I don't have access to a PIC at the moment).
Code: Select all
void main() {
int i = 1, side = 0; // side is set to left-to-right at first
TRISB = 0; // Set PORT B as all outputs
PORTB = 0; // Set all pins off
while(1) {
PORTB = (side == 0) ? ((0x00F0 << i) >> 8) : (0x0F00 >> i);
if (i++ == 12){
i = 1;
side ^= 1; // XOR will switch sides
Delay_ms(300); // Since we reached end, delay a bit more
}
else{
Delay_ms(100);
}
}
}
Code: Select all
void main() {
int i;
TRISB = 0; // Set PORT B as all outputs
PORTB = 0; // Set all pins off
while(1) {
// Left to Right motion
for (i=1; i <= 12; i++){
PORTB = (0x00F0 << i) >> 8;
Delay_ms(100);
}
Delay_ms(300); // Since we reached end, delay a bit more
// Right to Left motion
for (i=1; i <= 12; i++){
PORTB = 0x0F00 >> i;
Delay_ms(100);
}
Delay_ms(300); // Since we reached end, delay a bit more
}
}
Re: New Knight rider Flasher
It's cool Neo. I just compiled and simulated on Proteus. But only 1st one worked. I can't find error with 2nd one.Neo wrote:According to what I see, RAT only light up 4 LEDs at a time.
I was thinking to write a simplified logic for fun Write the most optimised code (in C and ASM) is like my best hobby. when you also try on that, I'm sure you'll get lots of fun out of it.
Rksk, can you try these codes and let me know? Since I haven't either compiled them or run them, there can be issues (I don't have access to a PIC at the moment).
If the above logic is complicated for you, try out the following one. Then I'm sure you'll be able to go for the first one which is more compact.Code: Select all
void main() { int i = 1, side = 0; // side is set to left-to-right at first TRISB = 0; // Set PORT B as all outputs PORTB = 0; // Set all pins off while(1) { PORTB = (side == 0) ? ((0x00F0 << i) >> 8) : (0x0F00 >> i); if (i++ == 12){ i = 1; side ^= 1; // XOR will switch sides Delay_ms(300); // Since we reached end, delay a bit more } else{ Delay_ms(100); } } }
Code: Select all
void main() { int i; TRISB = 0; // Set PORT B as all outputs PORTB = 0; // Set all pins off while(1) { // Left to Right motion for (i=1; i <= 12; i++){ PORTB = (0x00F0 << i) >> 8; Delay_ms(100); } Delay_ms(300); // Since we reached end, delay a bit more // Right to Left motion for (i=1; i <= 12; i++){ PORTB = 0x0F00 >> i; Delay_ms(100); } Delay_ms(300); // Since we reached end, delay a bit more } }
( my PC & JDM are doing crazy, they worked before and not working today. )
Thank you.
[ Post made via Mobile Device ]
Re: New Knight rider Flasher
I like it very much.......