{"action":"created","issue":{"url":"https://api.github.com/repos/arduino/Arduino/issues/6352","repository_url":"https://api.github.com/repos/arduino/Arduino","labels_url":"https://api.github.com/repos/arduino/Arduino/issues/6352/labels{/name}","comments_url":"https://api.github.com/repos/arduino/Arduino/issues/6352/comments","events_url":"https://api.github.com/repos/arduino/Arduino/issues/6352/events","html_url":"https://github.com/arduino/Arduino/issues/6352","id":233961145,"number":6352,"title":"Cann`t come out from [while ();]","user":{"login":"miladKhorasani","id":29234927,"avatar_url":"https://avatars3.githubusercontent.com/u/29234927?v=3","gravatar_id":"","url":"https://api.github.com/users/miladKhorasani","html_url":"https://github.com/miladKhorasani","followers_url":"https://api.github.com/users/miladKhorasani/followers","following_url":"https://api.github.com/users/miladKhorasani/following{/other_user}","gists_url":"https://api.github.com/users/miladKhorasani/gists{/gist_id}","starred_url":"https://api.github.com/users/miladKhorasani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miladKhorasani/subscriptions","organizations_url":"https://api.github.com/users/miladKhorasani/orgs","repos_url":"https://api.github.com/users/miladKhorasani/repos","events_url":"https://api.github.com/users/miladKhorasani/events{/privacy}","received_events_url":"https://api.github.com/users/miladKhorasani/received_events","type":"User","site_admin":false},"labels":[{"id":129578620,"url":"https://api.github.com/repos/arduino/Arduino/labels/Type:%20Invalid","name":"Type: Invalid","color":"f7c6c7","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-06-06T17:06:48Z","updated_at":"2017-06-06T17:28:09Z","closed_at":"2017-06-06T17:09:19Z","body":"In these program when i come in while than it is impossible to come out, i make the while condition false in interrupt.... \r\nlet me explain you the more interesting issue that i convert the same code to codevision environment after compile and upload everything gone right ..... \r\n\r\n\r\n\r\n\r\n\r\n//In The name OF God \r\n//Project : Phantom Haptic device \r\n//Designed By MiladKhorasani \r\n//*********************************************History***************************************\r\n//  01: 96/3/14  V.1 By Khorasani Make First Version \r\n//  02: 96/3/15  V.1 By Khorasani Make First Version - make diffirent Time(500ms-5sec-10sec) \r\n//******************************************Pin Assignment************************************\r\n#define ledPin 13\r\n#define ledPin1 8\r\n#define ledPin2 6\r\n//*****************************************Constants*******************************************\r\n\r\n     \r\n\r\n\r\n//Bit Setter & Resetter Definitions\r\n#define bit0        0b00000001\r\n#define bit1        0b00000010\r\n#define bit2        0b00000100\r\n#define bit3        0b00001000\r\n#define bit4        0b00010000\r\n#define bit5        0b00100000\r\n#define bit6        0b01000000\r\n#define bit7        0b10000000\r\n//***************************************BitField Definitions******************************************\r\n//Task Flags\r\n//rBitControl1\r\n#define   bIdleLoop         bit0\r\n#define   bCountTask     bit1\r\n#define   bLED                  bit2\r\n#define   bLed5sec          bit3\r\n#define   bLed10sec       bit4\r\n//****************************************Variables***************************************\r\nint var;\r\nint timer1_counter;\r\nunsigned char rBitControl1;\r\nunsigned char rBaseTimeCounter ;\r\nunsigned char rCounter5sec ;\r\nunsigned char rCounter10sec ;\r\n//******************************************Functions Declerations*************************************\r\n\r\n\r\n\r\n\r\n//******************************************Main Body of Program*************************************\r\n\r\nvoid setup()\r\n{\r\n  pinMode(ledPin, OUTPUT);\r\n  pinMode(ledPin1, OUTPUT);\r\n  pinMode(ledPin2, OUTPUT);\r\n\r\n  // initialize timer1 \r\n  noInterrupts();           // disable all interrupts\r\n  TCCR1A = 0;\r\n  TCCR1B = 0;\r\n\r\n  // Set timer1_counter to the correct value for our interrupt interval\r\n  //timer1_counter = 64911;   // preload timer 65536-16MHz/256/100Hz\r\n  //timer1_counter = 64286;   // preload timer 65536-16MHz/256/50Hz\r\n  timer1_counter = 34286;   // preload timer 65536-16MHz/256/2Hz\r\n  \r\n  TCNT1 = timer1_counter;   // preload timer\r\n  TCCR1B |= (1 << CS12);    // 256 prescaler \r\n  TIMSK1 |= (1 << TOIE1);   // enable timer overflow interrupt\r\n  interrupts();             // enable all interrupts\r\n}\r\n\r\nISR(TIMER1_OVF_vect)        // interrupt service routine \r\n{\r\n     rBitControl1 = rBitControl1 &(~ bIdleLoop) ;\r\n     rBitControl1 = rBitControl1 | bCountTask ;\r\n     TCNT1 = timer1_counter;   // preload timer\r\n  \r\n}\r\n\r\nvoid loop()\r\n{\r\n if( rBitControl1 &  bCountTask  )\r\n    {\r\n      runCountTask();\r\n      rBitControl1=rBitControl1 &(~ bCountTask);\r\n    }\r\n\r\n if( rBitControl1 &  bLED   )\r\n    {\r\n      led();\r\n      rBitControl1=rBitControl1 &(~ bLED); \r\n    }\r\n    \r\n if( rBitControl1 &  bLed5sec   )\r\n    {\r\n      led5sec();\r\n      rBitControl1=rBitControl1 &( ~ bLed5sec ); \r\n    }\r\n if( rBitControl1 &  bLed10sec   )\r\n    {\r\n      led10sec();\r\n      rBitControl1=rBitControl1 &( ~ bLed10sec ); \r\n    }\r\n\r\n  rBitControl1= rBitControl1 | bIdleLoop ;   \r\n  while (rBitControl1 & bIdleLoop)\r\n    {\r\n      __asm__(\"nop\\n\\t\");\r\n\t  __asm__(\"nop\\n\\t\");\r\n\t  __asm__(\"nop\\n\\t\");\r\n\t  __asm__(\"nop\\n\\t\");\r\n    }\r\n\r\n}\r\n\r\nvoid runCountTask (void)\r\n{\r\n  rBaseTimeCounter++;\r\n  if (rBaseTimeCounter >= 2) \r\n  {\r\n    rBaseTimeCounter = 0;\r\n    rBitControl1= rBitControl1 | bLED ;\r\n    rCounter5sec++;  \r\n    if (rCounter5sec >= 5)\r\n     {\r\n       rCounter5sec = 0 ;\r\n       rBitControl1 = rBitControl1 | bLed5sec ;\r\n     \r\n         rCounter10sec++;\r\n         if(rCounter10sec>=2)\r\n          {\r\n         rCounter10sec = 0 ;\r\n         rBitControl1 = rBitControl1 | bLed10sec ;\r\n          }\r\n      }\r\n   }\r\n    \r\n}\r\n\r\nvoid led()\r\n{\r\n  digitalWrite(ledPin, digitalRead(ledPin) ^ 1);\r\n } \r\nvoid led5sec()\r\n{\r\n  digitalWrite(ledPin1, digitalRead(ledPin1) ^ 1);\r\n} \r\n\r\nvoid led10sec()\r\n{\r\n  digitalWrite(ledPin2, digitalRead(ledPin2) ^ 1);\r\n} \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/arduino/Arduino/issues/comments/306558927","html_url":"https://github.com/arduino/Arduino/issues/6352#issuecomment-306558927","issue_url":"https://api.github.com/repos/arduino/Arduino/issues/6352","id":306558927,"user":{"login":"miladKhorasani","id":29234927,"avatar_url":"https://avatars3.githubusercontent.com/u/29234927?v=3","gravatar_id":"","url":"https://api.github.com/users/miladKhorasani","html_url":"https://github.com/miladKhorasani","followers_url":"https://api.github.com/users/miladKhorasani/followers","following_url":"https://api.github.com/users/miladKhorasani/following{/other_user}","gists_url":"https://api.github.com/users/miladKhorasani/gists{/gist_id}","starred_url":"https://api.github.com/users/miladKhorasani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miladKhorasani/subscriptions","organizations_url":"https://api.github.com/users/miladKhorasani/orgs","repos_url":"https://api.github.com/users/miladKhorasani/repos","events_url":"https://api.github.com/users/miladKhorasani/events{/privacy}","received_events_url":"https://api.github.com/users/miladKhorasani/received_events","type":"User","site_admin":false},"created_at":"2017-06-06T17:28:08Z","updated_at":"2017-06-06T17:28:08Z","body":"On Tue, Jun 6, 2017 at 9:54 PM Cristian Maglie <notifications@github.com>\nwrote:\n\n> Why are you so sure that it's a problem with the Arduino IDE?\n> Could it be an error in your sketch? Have you discussed the sketch with\n> some experts on the forum?\n>\n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/arduino/Arduino/issues/6352#issuecomment-306557572>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/Ab4W7_c_eZNnZN2ZBvflY0puOemR193hks5sBYswgaJpZM4NxpDu>\n> .\n>\nBecause i test the same sketch in codevision environment and it was okey ,\nbut I haven't discussed on the forum.\n"}}
{"actor":{"display_login":"miladKhorasani"}}