archive-nl.com » NL » P » PICBASIC.NL

Total: 182

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Connect Wisp programmer with a target PIC
    small PIC s you need an extra small circuit ICSP In Circuit Serial Programming The PIC can stay in his circuit while it is gonna be programmed So a builded circuit around a PIC which steers the components display LED s switches etc can still connect to the PIC when it is in programming mode when the next rules are followed Normally PORTB 6 and PORTB 7 are normal in outputs but are also used when the PIC is gonna be programmed While the PIC is programmed also the parts components which are connected with those two ports get these signals from the PIC programmer If PORTB 6 and or PORTB 7 is set as input then the connected component on this port i e a switch or optocoupler may not give any signal So a switch for example must stay open while the programmer is programming the PIC If PORTB 6 and or PORTB 7 is set as output then take into consideration that the connected component i e a relay or a LED is also steered by the PIC programmer A relay shall switch on and off very rapidly and a LED blinks very fast A LED that blinks fast doesn t matter but a relay for example maybe does depence on the builded situation Recommended in a situation like this is to choose another PIC port for the relay A connected component on these ports may take a maximum current about 10mA because else the PIC programmer can t deliver the signals from enough voltage A display which is connected to these ports default from PIC Basic can stay while the PIC is gonna programmed only while programming the display shows strange characters on his screen but it doesn t damage the display The MCLR pin from

    Original URL path: http://www.picbasic.nl/pic-wisp_uk.htm (2016-02-17)
    Open archived version from archive

  • Galva-Wisp low cost PIC programmer
    IC1 PIC16F648A download program from www voti nl IC2 MAX232 or HIN232 IC3 IC4 PC827 or LTV827 dual optocouplers LED1 LED2 Red and green LED Ø3mm 2mA low current type T1 BC547 NPN transistor see text TIP120 NPN darlington transistor see text D1 1N4007 diode D2 D3 D4 1N4148 diode D5 SB140 Schottky diode X1 Crystal 20MHz R1 R2 R11 1k R3 R8 47Ω R9 3k9 R10 2k2 R12 1k8 C1 C4 C6 C7 1 F tantalium C5 1000 F 6 3V or 10V radial see text C8 22 F C9 C10 22pF C11 100n axial comes under IC1 in the IC socket S1 Reset push button may left away Conn1 15 pole sub D connector male Conn2 9 pole sub D connector female IC sockets Own choice C11 is mounted on the inside of the IC socket under the PIC Pay attention for the wire connected on pin 7 from the 9 pole sub D connector Beware that the 2 optocouplers IC3 and IC4 are mounted with the indentation to each other The diode D5 must be a Schottky diode for example type SB140 C11 is mounted in the IC socket under the PIC The PIC must placed anyhow in a socket so that these from time to time can be replaced with new software so that the newest PIC types can be programmed Updating is possible by programming the update in another 16F648 first and then replace the PIC IC1 with it You can re program the old PIC for another project The Galva Wisp takes his power from the target PIC circuit where the PIC stays which has to be programmed 5V 25mA and the RS232 COM port 9V 12V Additional circuit Some PIC s like 12Fxxx and 16F630 16F676 can configure their MCLR pin as input These chips will in most cases fail to get into programmingmode when the MCLR pin is indeed configured as input Giving Vpp a fraction before the power from the target PIC is active solve this problem The Galva Wisp shorts the target PIC s power very briefly a few milliseconds while the MCLR pin goes to Vpp Schottky diode D5 and big capacitor C5 1000 F ensures that the Galva Wisp still has power during this brief period It s important that the 2 LED s are a low current type else capacitor C5 is to small The LED s burn with resistors R9 3k9 and R10 1k8 not very bright because of currentsaving when programming In any case the power to the target PIC must tolerate this brief short it must not deliver more current than the TIP120 darlington transistor can handle a few ampère and it must recover fast A 7805 or 78L05 based power supply will do fine some lab power supplies will not because they are designed to fold back after an overcurrent situation and recover slowly In such cases a 10Ω resistor in series with the power supply might solve the problem Note Choose a

    Original URL path: http://www.picbasic.nl/galvawisp_uk.htm (2016-02-17)
    Open archived version from archive

  • DCF77 clock-thermostat with PIC
    time on the display is not the actual time anymore because during adjusting from the timerblocks the PIC can not measure the DCF77 time at the same time so the clock runs a few minutes slow But don t worry after maximal 2 minutes the time is actual till the second again and the asterisk is disappeared Adjusting the timers looks intricate but really when this project is builded the story from above would be clear after playing a few minutes Cancel timers for a while By pushing button 1 PORTB 0 for a longer time is it possible to cancel the timers for a couple of hours To set the temperature at home on comfort manually press button 1 on off H L On the display changes the L Low into a H High and shows the temperature indication on the display the adjusted comfort temperature for a few seconds after that shows the actual temperature again The clock thermostat stays on comfort mode until another push on button 1 or till an adjusted OFF timer is reached This OFF timer switches the clock thermostat from H comfort to L economy temperature adjusting If that s not the intention then press button 1 a bit longer so that the hour counter starts counting up As long as the timers cancel time runs will the thermostat stay in the adjusted economy or comfort temperature mode irrespective of there are timers switching within that time The display shows how many hours are left the counter counts one hour back every hour When the time has expired then the heaters are regulated in accordance with the timeradjustments again A maximum from 99 cancel hours can adjusted This timer cancel time is direct interrupted when button 1 is pushed again What mode economy or comfort the thermostat will have depence on how the situation was when button 1 was pushed indicated with a L or a H on the display On the display on the photo hereabove will the thermostat stay for yet 14 hours in the H comfort mode irrespective of there are timers switching ON or OFF within that time After exactly 1 hour the counter on the display stays on 13 hr and counts further every hour till the time is passed When the time is passed the thermostat will be stay in the choosen mode H or L if there are no timers programmed for that day When there are timers programmed then the thermostat will stay in mode H or will switch to L depending from how the timers are programmed and what mode it must be for that moment When there is nobody at home for a longer period i e on holiday for a couple of weeks and there must nothing be switched it is not necessary to erase the timerblocks or to cancel the timers It is more handy to adjust the comfort temperature temporary to a lower temperature eventually equal to the economy temperature

    Original URL path: http://www.picbasic.nl/dcf77_thermos_uk.htm (2016-02-17)
    Open archived version from archive

  • Build a caller ID with PIC Basic
    then 2 seconds the LCD reports the question to erase all stored phone numbers For admitting push the button again when waiting longer then 2 seconds the CLI goes back to the original screen no erasing However when a new received number is not seen yet erasing is not possible The memory is empty again You can also enable TEST mode when you press the button while you switch the power on The LED burns when new number s are received and goes off when all the new numbers has been watched This LED blinks fast for a while when a received number is already stored in memory By a phone call or a push on the button the backlight from the LCD burns for about 30 seconds Direct after programming the PIC stays in TEST mode You can recognize it on the word TEST on the right on the second line in the LCD In TEST mode works the CLI normal but you can also test it Press on a parallel connected telephone first on the button this simulates a new receiving then give within a second fast a number and close with telephone button When you don t close with the PIC wil do it after a second Time out You can also enable TEST mode when you press the button while you switch the power on When you shut the power off for a few seconds and switch it on again the TEST mode is disabled The telephone buttons and doesn t work anymore The PIC itself doesn t need a crystal it runs on the intern oscillator Time date is a extension for the future Ports A 6 and A 7 are reserved for this This is a lowcost project when a HD44780 2x16 LC Display

    Original URL path: http://www.picbasic.nl/nummermelder_uk.htm (2016-02-17)
    Open archived version from archive

  • DCF77 clock with PIC
    two outputs on the DCF77 module one is direct the other one is inverted take the one direct next to the The 4 th conductor blue is for an other new project Program DCF77 is pretty simple Every second except second 59 comes a pulse from the DCF77 module For a 0 is the pulsewidth 0 1 second and for a 1 is this 0 2 second To detect the beginning from a new minute there comes no pulse on the 59 th second The program measures the time between the pulses and when there is one which takes more than 1 second no pulse is send out the program knows that the next pulse is the first bit from a new minute From then all the bits gonna filled in for a new minute Every time when there is no pulse on the 59 th second DCF77 protocol the program takes care for the 59 on the secondpart on the LCD by itself See DCF77 info Be aware that everything is transmitted in BCD format The hours have null suppression which means for example that 8 o clock AM not as 08 00 00 but as 8 00 00 is printed on the LCD Paritybits The program make use of the three transmitted DCF77 paritybits See DCF77 parity info Gong Real funny is a gong that sounds every half and whole hour This happens by making use of the soundgenerator IC SAE800 from Siemens This IC is the successor from the old SAB0600 For those who have at home an old SAB0600 SAB0601 or SAB0602 in stock is there a special scheme and PIC program only with a 2x16 LCD device Scheme and program with a SAB0600 SAB0601 or SAB0602 On every whole hour there sounds a 3 tone gong and on the half hours a 2 tone gong To activate the gong connect the SAE800 with PORTA 2 pin 1 and PORTA 3 pin 2 from the PIC Both ports gives every whole hour a short pulse and PORTA 3 also on the half hours Ofcourse you can use these pulses also for something else When it is dark the volume from the gong is set automatic to lower level special for the night s rest from pets Hów low the gong sounds depence on the value from R3 If the LDR is placed in the same room near to the clock then the gong sounds lower when the people are go to bed when the shaded lamps are switched off When no making use from this automatic volume option then connect PORTA 7 to 5V leave the LDR P4 and R2 change R3 to 18k and let PORTA 4 pin 3 open see scheme 2 Scheme 2 Adjustment By connecting PORTB 1 pin 7 with GND before the power is put on the circuit you ll come in testmode 1 and you can adjust the LDR with P4 how dark it must be before the gong is

    Original URL path: http://www.picbasic.nl/dcf77_klok_uk.htm (2016-02-17)
    Open archived version from archive

  • PIC programming with PIC Basic (1)
    0 5 second DELAYMS 500 0 5 second DELAYMS 500 0 5 second Above 3 lines are all three the same my preference goes to because assembler only works with the semicolon if you after a while put some assembler lines in your code with ASM ENDASM you don t have to switch over again because you have this way already got used it Be careful with GOTO Above in the first example GOTO is used Immediately here the recommendation to look out that it became no mess with GOTO s because at multiple use the overview goes quickly lost The program mentioned below blinks also a LED without the use of GOTO but with the command WHILE WEND Modify the previous program in the program mentioned below DEVICE 16F628A We use a 16F628A device CONFIG INTRC OSC NOCLKOUT WDT OFF PWRTE ON LVP OFF MCLRE OFF ALL DIGITAL TRUE All analog parts disabled WHILE 1 1 As long as 1 is equal to 1 TOGGLE PORTA 1 When on then go off when off then go on DELAYMS 500 500 milliseconds 0 5 second WEND execute this loop END Program end The label Again and GOTO are replaced by WHILE and WEND This command runs the program between the words WHILE and WEND here toggling from a LED so WHILE 1 is equal to 1 WEND go back to WHILE so the LED blinks always WHILE can t without WEND and they belong always both in the same program else you get an error Variable To make the function from WHILE WEND more clear we let blink a LED 4x after the power from the PIC is switched on Therefore we have to make a variable A variable is a name which can remember a value in this case it s a teller counter which keeps in mind how many times the LED has blinked Therefore exists the command DIM With DIM you make declare a variable with a name which sounds logical to the function it gets in the program below it is DIM LedTeller AS BYTE What now means AS BYTE Because a PIC does have a limited memoryspace you have to give information till howfar you think the teller counts and a byte is 8 bits 8 memory places which can have 256 different combinations so the teller can count from 0 through 255 not 256 namely 1 through 255 and the 256th is the value 0 You can also type DIM LedTeller AS BIT this takes only 1 memory place but then you can have only 2 situations namely 0 or 1 off or on and must the LED blinks more than 256x then you have to write DIM LedTeller AS WORD a word is 16 bits by this you can count till 65535 but it takes also twice as much memory space than a byte You can count much further with DWORD D ouble word which counts from 2147483647 through 2147483647 but it takes already 32 memory places 32 bits And there is DIM LedTeller AS FLOAT for numbers with a floating point which takes also 32 bits It is to be recommended to use DWORD and FLOAT as little as possible because calculations with these types use a lot of program memory from the PIC with BIT BYTE and WORD you can usely do all the work And finally there is AS STRING voor text on displays but more about this one later Modify the previous program in the program mentioned below DEVICE 16F628A We use a 16F628A device CONFIG INTRC OSC NOCLKOUT WDT OFF PWRTE ON LVP OFF MCLRE OFF ALL DIGITAL TRUE All analog parts disabled DIM LedTeller AS BYTE Declare variable with name LedTeller CLEAR Clear all RAM area Mainprogram WHILE LedTeller 8 While LedTeller hasn t reached 8 TOGGLE PORTA 1 On becomes off off becomes on blinking DELAYMS 500 500 milliseconds 0 5 second LedTeller LedTeller 1 Increase LedTeller with 1 WEND execute this loop HIGH PORTA 1 LED off END Program end Seen that the counter value reached a maximum of 8 because 4x LED on off means 4x LED on and 4x LED off you can use a byte thus DIM LedTeller AS BYTE Another new command is CLEAR Clear without a variable name behind it erases the contents from all variables not the variables itself but the value from every variable became 0 whereas CLEAR LedTeller only erase the content from variable LedTeller set to 0 A good habit is to clear all RAM area by putting the command CLEAR somewhere near the top of every program Then starts the mainprogram as the REM line reports WHILE LedTeller 8 what means something like while the LedTeller is smaller than 8 the programblock between WHILE and WEND must repeated In the block is an arrangement which adds LedTeller with 1 else LedTeller would always stay on 0 and then the LED blinks still forever This goes as follows LedTeller LedTeller 1 which means add the value from LedTeller with 1 and give the result back to the variable LedTeller on this way LedTeller value increases with 1 every time the LED is set on or off It s possible to add every value as long as the result is not getting higher than 255 because you declared LedTeller as byte It frequently occurs that counters tellers has to be count up or down with 1 herefore exists special commands INC LedTeller does the same as LedTeller LedTeller 1 inc rement DEC LedTeller does the same as LedTeller LedTeller 1 dec rement This all works only when the counter has count up or down with 1 Is the LedTeller 8x with 1 increased then LedTeller is no longer smaller than 8 and thus the WHILE WEND condition isn t TRUE anymore the program now goes further with the first command which comes after WEND And that s HIGH PORTA 1 something new again HIGH PORTA 1 means

    Original URL path: http://www.picbasic.nl/beginners1_uk.htm (2016-02-17)
    Open archived version from archive

  • Electric window
    x 10mm Angular metal Small Motor RB 35 1 600 The distance between the holes in the aluminiumstrip is 95mm The distance between the holes in the metal strip is 75mm In the metal strip comes at right angles to the Ø6mm hole for the motor shaft a hole with thread in it The screw which comes in there comes on the flat part of the motor shaft to provide it against slipping I ve made also a saw cut in the metal strip to squeeze the metal strip on the motor shaft but this isn t really necessary The two hinges are made from a screw and 2 nuts Twist the screw and one nut in such a way that there is a little play left so that the two parts can hinge to each other A second contra nut with a springring between it are twist against each other Window closed Window starts opening Window is almost opened Window is opened within 3 seconds There isn t make use of endswitches the steering knows howlong it takes to open or close the window and after that time the power is switched off With a relay or a motordrive

    Original URL path: http://www.picbasic.nl/raamopener_uk.htm (2016-02-17)
    Open archived version from archive

  • The working from the DCF77 time signal
    cable isn t necessary but place on the side from the DCF77 module a serial resistor from 100 Ω and after that a tantalium capacitor from 4 7 over the power supply see scheme s The unshielded cable between the DCF77 module and the PIC inside my home is 10 metres and works unproblematic Take if it s possible a cable with 4 conductors the DCF77 module needs only 3 but the fourth conductor is used in another project There are two outputs on the DCF77 module the right one is direct the left one is inverted take the direct one next to the The 4 th conductor blue is for an other new project PIC program DCF77 is pretty simple Every second there comes a pulse from the DCF77 module For a 0 is the pulsewidth 0 1 second and for a 1 is this 0 2 second Thus Measure till a pulse comes in Then a delay from 0 15 second Then measure again Is the pulse already gone then you ve received a 0 and if the pulse is still there it is a 1 The program in the PIC expect every second a 0 or 1 so if there is after a second nothing received the PIC knows that the next second must be second 00 from a new minute The value from the second is not transmitted to make a time indication with seconds the PIC program must have a counter which counts up every time when a bit is received and display it on a time indication LCD or LED display and if one second nothing is received second 59 must there be 59 displayed on the time indication All values are transmitted since 1973 in BCD code more info about BCD Paritybits It is recommended to make in every PIC program use from the three DCF77 paritybits the programs from this website do There is a paritybit for the minutes the hours and for the date DCF77 works with even parity this works as follows The hours for example have 6 bits plus a paritybit see bitgraduation in the minute underneath The bits which are 1 are add up inclusive the paritybit the result must be an even number If there is a bit wrong received a 0 is as 1 or a 1 is as 0 received then the result is uneven Suppose it is 8 o clock in the morning the 6 bit hour bittrain is then 00 1000 08 BCD Because there is only 1 bit high is the paritybit for the hours which is transmitted direct after it also a 1 to come to an even number If the result is uneven parityerror the PIC place the wrong received time or date not on the LCD Instead of this the PIC must calculate the actual time from out the previous time by hisself and place thís on the LCD In case of a parityerror Increase the present minute with

    Original URL path: http://www.picbasic.nl/info_dcf77_uk.htm (2016-02-17)
    Open archived version from archive



  •