* source code for mikroC PRO compiler V1.65
* feel free to use this code at your own risks
*
* target : PIC12, oscillator in HS mode, watchdog enabled
*
* PIC PIN Assignemnt :
*
* GP0 : detect LED indicator
* GP1 : calibrate LED indicator
* GP2 : NC
* GP3 : NC
* GP4, GP5 : inductor
*
*******************************************************************************
*/
#define MAXTRY 15 // number of watchdog restart to calibrate loop counter
unsigned char ctr ; // number of loops between two watchdog resetsunsigned char previous ; // previous value of ctrunsigned char calibr ; // calibration value when oscillator runs freeunsigned char restarts ; // number of watchdog restartsunsigned char en ; // enable flag, allows detection
/*
* main loop
*/void main() { unsigned char i ;
/*
* configure GPIO as digital port
*/ CMCON0 = 7 ; ANSEL = 0 ; TRISIO = 0 ; GPIO = 0 ;
/*
* power up ?
*/ if(STATUS.NOT_TO) { /*
* yes, init variables
*/ restarts = 0 ; calibr = 1 ; }
/*
* watchdog reset counter
*/ if(restarts < 255) restarts++ ;
/*
* if counter differs too much from calibration value
*/ if((previous ^ ctr) > calibr) { /*
* turn detect LED on
*/ GPIO.F0 = en ;
/*
* if not on power up
*/ if(STATUS.NOT_TO == 0) { /*
* while in calibration mode
*/ if(restarts < MAXTRY) { /*
* shift calibration value
* and wait a little bit
*/ calibr <<= 1 ; Delay_ms(5) ; } } else { /*
* turn detect LED off
*/ GPIO.F0 = 0 ; } }
/*
* save last counter
*/ previous = ctr ;
/*
* is calibration over ?
*/ if(restarts > MAXTRY) { /*
* yes, turn calibrate LED off
* and set enable flag
*/ GPIO.F1 = 0 ; en = 1 ; } else { /*
* no, turn calibrate LED on
* and clear enable flag
*/ GPIO.F1 = 1 ; en = 0 ; }
/*
* set watchdog prescaler
*/ OPTION_REG = 0b11111001 ;
/*
* start counter, to be interrupted by watchdog
*/ ctr = 0 ; for(;;) { ctr++ ; } }
Home »
Posts filed under detektor
Showing posts with label detektor. Show all posts
Showing posts with label detektor. Show all posts

Streaming video sites supported by Bywifi Video Accelerator are:
YouTube, Facebook, Dailymotion, Veoh, Metacafe, 56.com, Youku, Tudou, CrunchyRoll, MegaVideo, 5min, 6.cn, 9you, Angry Alien, AnimeEpisodes.Net, Badjojo, Bebo, Blastro, Blennus, Blip.tv, Bofunk, BollywoodHungama, Break, Broadcaster, Buzznet, Chilevision.cl, ClipFish.de, ClipLife.jp, ClipJunkie, ClipShack, CollegeHumor, Current, Current TV, Dachix, Danerd, DailySixer.com, dalealplay, DevilDucky, Disclose.tv, DoubleAgent, eBaumsWorld, elpolvorin, eSnips, ExpertVillage, EVTV1, FindVideos, Flurl, FunnyJunk, FunnyorDie, Glumbert, GodTube, GoFish, Google Video, Graspr, iFilm, Hallpass, HowCast, HowStuffWorks, iShare.Rediff, Jokeroo, Jumpcut, Justin.tv, Kewego, Kontraband, ku6, Izlesene, LiveVideo, LiveLeak, lulu.tv, Mediabum, Midis.biz, MilkandCookies, Mojoflix, MonkeySee, Music.com, MusicMaza, MusicVideoCodes.info, Myspace, MyVideo.de, Newgrounds, NothingToxic, Pikniktube, Pixparty, Photobucket, PlsThx, PokerTube, vbox7, Viddyou, Videa.hu, VideoWebTown, VideoCodesWorld, VideoCodeZone, videolectures, Vidiac, Vidivodo, vidiLife, VidPK, Vimeo, VReel.net, vSocial, Yahoo Videos, WeGame, Wuapi, Yikers, Yobler, YourFileHost, YouSportz, YummyBun, ZippyVideos, Zoopy, zShare.net, Putfile, PWNorDIE, RetroJunk, Revver, RuTube.ru, SantaBanta, Sevenload, Sharkle, Shoutfile, Sina Videos, SmitHappens, Snotr, Spike, StreetFire.net, StupidVideos, SuperDeluxe, SuperNovaTube, TeacherTube, That Video Site, TheOnion, TinyPic, TotallyCrap, tu.tv, and life-7.com
Description:
A single chip metal detecor with a range of a few inches. This is useful for decting nails or screws in walls and floors, or for locating buried mains cable.
Notes:
The heart of the circuit is a single IC the CS209A made by Cherry Semiconductor. The detector, is a single 100 uH choke. The IC has an integral oscillatorm the choke forms part of an external LC circuit, its inductance being altered by the proximity of metal objects. It is the change in oscillation that is amplified and demodulated. Led 1 will light and the buzzer will sound when the choke change sinductance. Set up is easy, VR1 is adjusted with the cjoke away from any metal source so that the LED lights and buzzer sounds. The control is backed off so that the LED goes out and buzzer stops. Now when the choke comes into contact with any metal object that alters its inductance, LED 1 and the buzzer will activate.
Since I first wrote this article Maplin no longer sell the CS209A. However the same part CS209AYN8 may be bought from ON semiconductors. Note that the package 626-05 is the 8 pin DIN type that is required.
A single chip metal detecor with a range of a few inches. This is useful for decting nails or screws in walls and floors, or for locating buried mains cable.
The heart of the circuit is a single IC the CS209A made by Cherry Semiconductor. The detector, is a single 100 uH choke. The IC has an integral oscillatorm the choke forms part of an external LC circuit, its inductance being altered by the proximity of metal objects. It is the change in oscillation that is amplified and demodulated. Led 1 will light and the buzzer will sound when the choke change sinductance. Set up is easy, VR1 is adjusted with the cjoke away from any metal source so that the LED lights and buzzer sounds. The control is backed off so that the LED goes out and buzzer stops. Now when the choke comes into contact with any metal object that alters its inductance, LED 1 and the buzzer will activate.
Since I first wrote this article Maplin no longer sell the CS209A. However the same part CS209AYN8 may be bought from ON semiconductors. Note that the package 626-05 is the 8 pin DIN type that is required.