ahatmob
Newbie level 5
- Joined
- Sep 15, 2014
- Messages
- 9
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Location
- egypt- cairo
- Activity points
- 54
hi i design a chronometer but didnot work in real prototype although it works in the protues simulation
there is the code work in simulation but not in the real mikro controller design here is the code:
there is the code work in simulation but not in the real mikro controller design here is the code:
Code dot - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 //Chronometer original ////////////////////////////// ////// Pin direction //////////////////////// sbit LCD_RS_Direction at TRISd4_bit; sbit LCD_EN_Direction at TRISd5_bit; sbit LCD_D7_Direction at TRISd3_bit; sbit LCD_D6_Direction at TRISd2_bit; sbit LCD_D5_Direction at TRISd1_bit; sbit LCD_D4_Direction at TRISd0_bit; //////////////////////////////// ///// Lcd pinout settings /////////////////////////////////// sbit LCD_RS at Rd4_bit; sbit LCD_EN at Rd5_bit; sbit LCD_D7 at Rd3_bit; sbit LCD_D6 at Rd2_bit; sbit LCD_D5 at Rd1_bit; sbit LCD_D4 at Rd0_bit; ///////////////////// ////parameters /////////////////////// const a,b; long t; double speed; char v1[12]; int x=0x00; int y=0; //////////////////////// ////interrupt fn ///////////////////////// void interrupt(){ if(intcon.f0){ t++; } if(intcon.f1){ y=1; x = portb; INTCON.f0=0; INTCON.F1=0; } portc=t; } //////////////////////////////////// // main fn /////////////////////////////// void main() { Lcd_Init(); b: Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Out(1,1, "bullet speed m/s"); trisc =0x00; trisb =0xff; portc =0; portb=0; option_reg =0x90; INTCON =0x98; if(y==1){ speed=100000/t; FloatToStr(speed,v1) ; Lcd_Out(2,2, v1); delay_ms(1000); Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1,1, "take next shoot"); delay_ms(1000); Lcd_Out(1,1, "bullet speed m/s"); delay_ms(1000); t=0; portc=0; y=0; /*INTCON =0x98;*/ } goto b; }
Last edited by a moderator: