Questions:
Hi, I am currently using A PIC16F876 to store Dallas iButton information to a 24LC256. I seem to have a problem in the respect that I am storing byte for byte as the iButton get presented. But when I come to byte number 63 it goes ahead and stored Byte 63 at location 0 again and right after that it then goes on with byte 65. I have check my data which I am sending to the chip and I am clearly giving the chip an excellent stop condition after every byte. Has anybody see this before or can someone reccomend proper I2C routines for the 24LC256 chip.+
Hi, I am using pic 12f675 and MPLAB574 IDE .I have one trouble with GO/DONE bit on ADCON0 register, in an A/D simulation. This trouble do not exist in PIC 12C671 simulations on the same MPLAB 574 IDE. In this PIC12c671, first it turn ON de ADON bit (bit0). In a next step, it turn ON the GO/DONE bit (bit2). This bit stay ON until A/D conversion is completed.(good!)+
However, with the PIC 12F675, the ADON (bit0) always reach the ON state, but the GO/DONE bit (bit1 in 12F675) never reach the ON state in simulation.
I have checked all registers and its bits with data sheet.
Question: this trouble is a human error or a specific limitation of MPLAB IDE for PIC12f675?
Thanks for answering me
Nestor Galvan - Argentina.
Hi, I got a serial programer and want to program my 16f628 to move a c-band satellite mount with my solar panels atop. Anyone tell me how hard this is going to be? I think I may have already waisted my first 2 chips as when my ic prog programs starts to burn a chip it asks if you want to enable code protections and I let it do it..are they waisted? thanks, Mark+
Hi, new to pics. just got a serial programer and project board along with a couple 16f628 chips. Want to program a chip that will move my c-band motorized mount with my solar panels atop. I got the programer and put the chip in and thought Id load a program I downloaded from the site where I bought the stuff. After trying to load the blink.hex program it halts and says failed at address 0000H. now I read on this web page that you should never enable code protection. Seems thats the second question my ic prog program asks me..and I let it enable the code protection..is my chip fried now..and can anyone tell me how hard its going to be to make a program that will move my satellite mount every 15 minutes or so to track the sun and send it back to starting position at midnight? thankss for any help. Mark+
Hello Everybody,+
I need help regarding problem I am facing with application using PIC12F675. The application works fine first time after power on. But after shutdown and subsequent poweron, the application works erratically.
But the same application works fine with PIC12C508A. I am not using interrupt, A/D Converter and Comparator function of PIC12F675 and also using its internal clock.All the I/O's are digital.
The configuration bits have been set as follows:
Oscillator : Internal RC I/O
Watch dog Timer : Off
Power up Timer : on
Code Protect : off
Brown out detect: off
Master Clear : external(same in PIC12C508A application)
Data EE Protect : off
I have done the initialisation of source code as follows:
bcf STATUS,RP0
movlw 07h
movwf CMCON
clrf INTCON
bsf STATUS,RP0
clrf ANSEL
movlw b'00101111'
movwf TRISIO
clrf OPTION_REG
clrf WPU
call h'3FF'
movlw OSCCAL
bcf STATUS,RP0
clrf GPIO
Please advise how to overcome erratic working of application using PIC12F675 after first powershutdown. Is PIC12F675 susceptible to Electro Magnetic Interference?. Thanks
Hi, I am a beginner in PIC programming.the device is 16f873 and MPLAB IDE 6.10 . when i use IF,MACRO and WHILE in program it can not work properly ,Can anyone give me some solution for my problem .+
Hello, I'm making a school project with a PIC16F876 where I'm making a traffic counter. I use two contacts so I'm able to log the cars speed also. my problem is that I need to use Timer1 as the other two timers are only 8bit and thus cant measure slow cars without overflow. so the question is: How can I calculate a speed from two registres. (contact distance is 0.3 meters)+Mail: Bo Kristensen
I'm working with a 16C71, I am running a D to A conversion forJames Newton replies: Scaling is done by multiplication. Look in the routine library+
input in the 2 to 3V range. I need to scale this data to determine duty cycle for a PWM output. The output range is 0 to 5V. I need some pointers on how to do this.
For CC5X C-programmers:James Newton replies: Since you must be using a legal, registered copy of CC5X, why don't you contact the support center for the product?+
Hi !
Is there a way to offset the automatic allocation of RAM in CC5X? Say for example, I want my char variables to be allocated starting with 0x70, or in EEPROM, NOT at 0x20. Is there anything besides writing "char MyVar @ 0x70, ..." etc. ? Thanks for your answer! Mihai, Bucharest, Romania.
Hi everybody, I am working on 16F870 and obtained binary data from A/D converter on CH0, I have also displayed it as BCD on 4 digits multiplexed display.+
Can anybody please, send me the routine to display A/D data into actual voltage, on multiplexed display?
A Pic Newbie, I'm studying the excellent cheapic tutorial. Somehow when making a change to the project I code protected my 16f84a. can someone help me understand how to use this excerpt from Microchip ds30262e? or is there an easier way to erase it and start over?+
Thanks,
Ray
"4.1 Disabling Code Protection
It is recommended that the following procedure be performed
before any other programming is attempted. It
is also possible to turn code protection off (code protect
bit = ‘1’) using this procedure; however, all data within
the program memory and the data memory will be
erased when this procedure is executed, and thus,
the security of the data or code is not compromised.
Procedure to disable code protect:
1. Execute load configuration (with a ‘1’ in
bits 4-13, code protect)
2. Increment to configuration word location
(2007h)
3. Execute command (000001)
4. Execute command (000111)
5. Execute ‘Begin Programming’ (001000)
6. Wait 10 ms
7. Execute command (000001)
8. Execute command (000111)"
I recently wrote a assembly language program for an LCD display+
using the 16F84, I am now trying to use the same program for the
18F452, can you help me on the things I need to change in the
program such as registers and/or instructions. I used 8-bit
interface and a 16x2 LCD. If there is a way to simply convert the
16 family to the 18 family I would appreciate it if you could assist
me in finding it. thank you.
I Am Using A PIC 16F84A MPU... Is There A Special Trick To Writing And Reading From The EEPROM??? If Not Them Why Is It There??? I Don't Want To Have To Add A EEPROM Circut To My Existing Layout... Are There Any 18 sdip PICs Out That Do Have The R/W Capacities??? (i'm kinda new to this... can you tell???)+
[PIC]:+
Hello,
I am new to the world of PICs.My current aim is wireless communication using PIC,my MPLab ICD ,Linx technology RF antennas are in their way being shipped and i want to get familiar with PIC lingo, and am trying estimate the real complexity of the problem.
Basically an analog signal needs to be communicated to reciver with in 5 meters range.The revicer end would have another PIC taking in the data and responding according (by flashing an LED).
Any comments /ideas/ suggestions and References so that i can learn ...plz !!
I was trying to dwell down the site ..but kinda lost in this OCEAN ,Oooph i look like an ant :o)
Cheers,
- schkrodinjer
Hello, Sir, could you tell me if all interface USART is support rs485? could you mail me a program sample for rs485 transmiter and reciver. thank you very much.+
hello+
I need information about the sequences to drive a stepper motor with microstepping, for example 400 ppr for 1.8/degree motor
Thank you
Norma Guarnizo
on a PIC16F628A if the configuration register is set so that MCLRE=0 (RA5 is digital I/O, not MCLRE) can this pin still be used for High Voltage Programming mode?+
hello, i am new to PIC programming. My current project involves using a 16F84! I want to output some a decimal number, to a display. I have to output the number in serial form for the display driver. Any ideas? I am stumped, because my C programming is weak.+
well i am sorta new to pics and have a few projects i have cooked up but not sure what pics to use and such and am looking for help and suggestions project #1 a lcd display that will display manifold vacume and boost from a pressure transducer on a turbo charged engine plus intake air temp from a iat sensor and possibly engine temp or oil pressure with the possibilty of adding more later like about maybe having about 6 sensor inputs displayed on a lcd at the most #2 a pic timer that will open 2 solenoids once every 2 or 3 hours for a duration of about 30 seconds or less+its for a air compressor moisture bleed 3# a cheezy automatic servo controlled air damper to regulate the temp of my smoker :) by varying the amount of air coming in through a large butterfly valve for a given temp starts getting over the set temp it slowly closes gets under it slowly opens any help or suggestions would be great e-mail reply's would be great
I am programming a 16f874 and need to use six anolog inputs. I am using the a/d converter and am having trouble getting accurate readings. One a/d conversion works, but when two are programmed in, it still only takes one a/d conversion and gives that as the input for both a/d conversions. I am using a 4Mhz oscillator and have tried nearly every route. Does anybody have any sample code for MPlab that take more than one a/d conversion that I may compare for troubleshooting.Thanks.+
I think the answer to my question is obvious, but in case there are minds much more clever than mine out there: Is there any way to write parallel re-entrant routines for the PIC16F84, that is, routines (which use more than just W for parameter passing) which can be called from both the mainline and interrupt code without having to disable interrupts in the mainline? Cheers, Neil Higgins+
Im looking for a 32/32 bit divide function that will work with the PIC18F452. I used a function written (well actualy it was the modified AN575 microchip stuff )by a guy called ingvar gillholm which worked a treat on a 16F877 but unfortunatly wont work with the 18F series. I use picbasic pro V2.41 with the MAPSM assembler. If anyone can help i would be most greatfull.+
I have a problem. I just got the PIC16PRO programmer and using MPLAB. I'm new at PICs but have been programming for the 68HC11 for quite some time, so the code is easy to pick up. To test out the programmer I downloaded an LED program. Simple program that just turns on and off an LED. I programmed the chip and verified that the code was there, but when I hook everything up, nothing happens. I know the code is correct and so is the schematic. Is there something I'm missing? The PIC I'm using is the 16F628.+
Can anyone please help having major problems trying to interface a HD44780 based 16x2 to a PIC 18f452. tried using stuff off the web but this was based on 16 or 17 series , doent seem to work on this pic. Ive connected it in 8-bit mode. If anyone could send me some code to get it to turn on this would be greately appreciated. Thanks
MPLAB 6.0.2 Unable to set breakpoints in source file. After creating a new project and importing a source file I cannot set breakpoints. I have some projects which I can but it seems like new projects won't allow this. This has been an on-going problem which I can't seem to find the real solution to.
spammichael.lebedev~NOSPAM~ at purchase.edu Nevermind, I have figured out the problem. Please do not reply to my previous question. It seems as if somewhere during my testing the sensor I was using must have gone bad. I changed it and realized that the real problem with my circuit was the lack of a decoupling capacitor on the Vdd pin of the PIC.
spammichael.lebedev~NOSPAM~ at purchase.edu Hello All, I am new to PIC programming and electronics in general. I am currently working on my senior project for college, which involves creating custom MIDI controllers for an interactive sculpture. Currently, I am trying to interface Sharp GP2D15 sensors to a 16F84, but I have hit a roadblock in my limited knowledge. My code is working properly, as I have tested it with normal switches and such. Here is the problem from my understanding of it: The GP2D15 has an open-drain output (Vo) which needs to be pulled-up to Vdd in order to get an output voltage. If I then connect Vo to an input pin on the PIC or to the base of a transistor for example, then the input pin is also recieving voltage from Vdd through the resistor. I am thinking about this in the wrong way? Has anybody been able to successfully connect these Sharp IR sensors to the PIC. Thank you in advance.
hi,
i want to learn PIC micro programming i m raw hand to programming please someone tell me where to start and some good books also.
i m from india
good morning sirs, really i want to thank you for your great efforts you supply to us and i have a question :
how could i connect pic16f84 with pc for serial communication means using rs232 and with visual basic6 . please send send these codes and program in vb6, thanks to all and good bye.
I am very new to pic's (yesterday).
Problem- when I step though a basic program everything goes ok, but when i get to the last instruction it doesn't execute and the program memory window is brought up. any sujestions would be great.
I am sure the progrm is right because they from this sites tutorial by Jim Brown, and sometimes they run though fine
I am using MPLABS 3.12
hello ,i have a problem with mplab icd when i want to do debug>run, it tells me that i have a error performing requested operation, but i have a good configuration of mplab so i need help please. i verify the pin rb7 and rb6 and no problem.
thanks
Hey, I would like to directly interact with someone who can help by walking me through the building and programming of a PIC-based digital-bargraph audio level meter with microphone and more importantly help me by not only telling me what to do, but explaining why I should do it so I can learn this myself. Sort of an apprenticeship-type thing, learning by doing. It would be even better if said person had enough free time that we could continue to shoot messages back and forth with each other. I can never get my questions answered on Usenet; there are so many people on there that nobody really bothers to focus on any particular question.
/techref/piclist/www.1n0s.com Having problem with PIC16F874 UART operation concerning the TRMT bit. Microchip says that the TRMT bit = 0 while the shift register is shifting. BUT, I found that it does NOT seem to work in the sense that if I wait for it to go high then turn TXEN = 0 then part of the Tx shifted out data is truncated! Anybody else experience this?
Hi, i recently purchased the MPLAB-ICD. However since my notebook did not have an rs232 port, i used a USB to serial converter(UC-232A) to overcome this problem. But when i connected the ICD to this port and launched the IDE, it would not detect the ICD (something about the comm port and baud rate). The literature with the converter stated that the UC-232A installs as a virtual port driver on com3. If anyone has experienced this problem or knows how to correct the problem, please contact me.
Cheers
barry
Hi, I'm new to pic programming and was looking over Tom McGahee's combination lock program. I was wondering if there's a way to multiplex a 7-segment LED to display the number pressed? Need answer urgent mail me, thanks in advance.
I am programming a 16f84 to do various tasks and am looking to store data that loosing power wont effect(VDD&MRCR). So I can use the information when power is applied.
James Newton replies: Check into EEPROMs. +
Your message was not delivered within 3 days.
Host mrus.fsnet.co.uk is not responding.
Hello, I have a problem, i have to program a 16f77 and i have a propic2 programmer with propic2 software, but 16f77 is not in the list of devices and i don't know how to make it work, can anyone give me some advice? Send me a response
Hi, I am trying to control the position of a stepper motor in real time depending on the analogue input level. I also need to be able to set the number of steps to full input. Any help on this would be greatfully received. The PIC is a 16F73.
Hello everyone, I am new to PIC programming and am having trouble finding the right information. I need to perform the communication between PIC and PC using USB,and the PIC is used to control the data acqusition system. But I don't know which kind of PIC can communicate with PC using USB.And if I must finish this work in the shortest time which one should I select?where can I get the detailed information about this?I will be appreciated if you can give me some advice.
I am trying to control a standard R/C Servo motor with a PIC16f876 20Mhz using the CCP module and timer 2 for PWM. The problem is that the PWM pulses should be of length 0.75ms - 1.25 ms with about 10ms delay in between. However, the lowest pwm frequency which can be generated using the hardware setup I have seems to be 1,22kHz (0,819ms) which does not allow for proper control of the servo. Is it possible to do any kind of software tweaking to make the PWM module run any slower without altering the hardware? Thank you!
can any one tell me where i can find any reference to built a PIC testing board? i wanna test on my programmed PIC c whether they works as i want or not?! thanks
i want to have ra3(pin 1) on 16f84a alternate high and low at 30 second intervals to control motor direction through an lmd18200. can someone give me code for this? thanks
Hi there everyone, I am new to PIC programming and am having trouble finding the right information. I need to connect a PIC to a PC using the RS-232 port, I have found many program that take one character and respond to it.... But I would like to be able to send commands such as, SPEED 400 and MOVE 1000 does anyone know how this can be done or of any good websites on the matter. Thanks in advance, Gary
Hi there everyone, I am new to PIC programming and am having trouble finding the right information. I need to connect a PIC to a PC using the RS-232 port, I have found many program that take one character and respond to it.... But I would like to be able to send commands such as, SPEED 400 and MOVE 1000 does anyone know how this can be done or of any good websites on the matter.
Hi, I'm fiddling with CCS C compiler to see if I like it and want to know why when I try to run my PIC ICD does it start to execute the code at Program Counter 0x02. This is as seen in the program watch window after a "reset" - always. This is a real nuisance 'cos the two preceding lines "movlw 0x00 & movwf 0x0A" are skipped and they are needed to set the page control PCLATH to zero. Hence the goto line for "void main ()" in PC 0x02 actually gets added to 0x1800 (which is page 3), and therefore of course my code cannot run without lengthy and painful work arounds. Anyone out there kknow what I'm doing wrong & how I can get past this hassle? Regards Ant
I am building a project that needs to run at -40c and off a battery/solar cell. Either seems to be easy... both difficult. The problem I run into is a crystal draws ~10ma (I'm shooting for the circuit to draw <1ma while idle/asleep) and a ceramic resonator does not want to start up when cold. I found one solution for the 16F876; put the PIC into reset for a sleep mode. It drew about 500ua. I ran out of program space and went to an 18F252 (pin compatible with circuit) but it draws ~900ua in the same condition. Is there any way to keep the resonator running while the pic is in 'SLEEP'? Please send any ideas or help. Thanks
I am suffering the problem ,is my program is not working properly in 16c73b .but the same program is working in good manner ,in 16f73.my program has bellow 1k byte of memory need and is utilising almost all the features of the ic ,may i get any help to solve this problem
I am trying to use the writecode command in pbp240. The manual says you must have Flash Program Writes enabled in the configuration for the PICmicro for this to work. How do I enable Flash Program Writes????
/techref/member/rrestrepo-wetautomotive-/index.htm After entering the code in Microchip AN654 and building the project, I am getting the following "messages" in the Build Results (note, I changed from the 16C71 in the AN to a 16C716): Message[302]: Register in operand not in bank 0. I am getting the same message for the statements: movwf TRISA, movwf TRISB, movwf ADCON1, movwf OPTION_REG. I don't understand why the message(s), because I am already selecting Bank 1 with the statement: bsf STATUS,RP0 I don't know if it these errors are related to the command: LIST P=16C71, R=DEC (I changed it to P=16C716, R=DEC). Would you know what the options are for the LIST command? Thank you.
im new to pic programming,ive already built the noppp programmer and run the noppp software,but i dont know the correct syntax for the setting up the pics fuses,can anyone help?????? my e-mail is at mcl_1qmd@yahoo.com thank you...
hello, I found a programm (fntcvtr.exe) on the internet and must say that it is most helpful. There is only one problem and that is that we use a different output format in our applications. I was wondering if it would be possible to get the source code for this programm so we can edit it ourselfs to make it work for our applications. Anyone has it ?
Hello! Does anyone have source code for a pulse ratio "calculator"? The pulse period is about 10 ms and the ratio between 45-55%. If you can help, please reply to aryhanen@cc.hut.fi. Thanks!
Hi I am completely new to PIC programming and need some start-up advice. I have searched the archive for an answer to this question but not found anything so please forgive me if I have missed the obvious answer . I want to set up a software development system with a slick edit/execute cycle. I have installed MPLAB and have studied home-brew programmer circuits, and understand the principle. (I am interested in 16F62x, but believe many of the published designs could be adapted to this chip with only pin-out modifications). I notice that MPLAB has a PICSTART+ button that invokes a loader for that proprietory programmer.My question is is there a design for a home-brew programmer (with rs232 connection data) that is compatible with the PICSTART+ loader and that will work with MPLAB if I just plug it into a COM port ?
Alternatively Is there a design for a programmer, with support loader software that can be bolted on to MPLAB to give a one-button programming function.
On the third hand is there an assembler/loader alternative that can be used with a home-brew programmer ???
Andy
Hi! I'm trying to write to EEPROM on a 16F877. EEADR accepts only values between 0-31. If I try to write EEADR=32 and the read the EEADR-value, it is 0. EEADR seems to be 5 bits wide. Why is this so? A bug or a feature?
Hi, I am having a problem writting a program for the pic16f627 in MPLAB, i managed to write one that counts from 0 to 9, but now i need to write one that counts from 0 to 99 and be able to display it on two seven segments..any help will be highly appreciated..thanks
Hi, I have always writed absolute code for my PICs, now I would like to write with linker. Could someone help me to find information, explanation and example how to use the linker (for F876 if possible) ? Many thanks. Fulvio
can someone point me to a possible freeware/shareware compiler so I don't have to go through lines and lines of ASM to program PIC chips...do these exist?
See: languages
I am having trouble interfacing the ICD with PIC16F876A. Has anyone succeeded in programming this device with ICD? is there another DIY programmer solution available for this device? Thanks, Gil
HI I am attempting to get started in PIC and have everythimg I need except the MCU. My question is what do you recomend from an OTP replacement for the PIC16F84. The flash chips are expensive and I want something cheap and permanent (I hope to develop projects on the 'F84). Thanks ....Joe
Hello, I'm using MPLAB 5.62, HTPIC18 8.12 and ICD2. I have problems when debugging my projects - when stepping trought the source code with ICD2 I step always into PROGRAM memory. For example if one C source row is represented with 10 instructions in program memory I have to press STEP button 10 times to go to the next C row. If I set my project to MPLAM SIM simulator - then everything is OK. The same problem I have with ICD and HTPIC16 8.PL2. I can't rememeber when exactly began to occure this problem, but I'm sure that in the beginning I was able to step correctly within source code with ICD. After I migrate to newer MPLAB version I began to suffer from this problem. Even the source code window becomes locked (pressing the cursor over it doesn't focus on the window), until you don't press first the PROGRAM memory window or watch window. I'm currently using the last possible version of MPLAB for ICD - 5.62. I know that MPLAB has many "good known" bugs (for example with EEPROM of uP operations), so I'll be not surprised if this is just one bug of MPLAB. I set GENERATE DEBBUG INFO to ON in both nodes (main and compiled). I'm sure that there is some simple solution of this problem - maybe I didn't add some option key or something like that. Best regards and thank you for yor attention Luben Hristov
Hi every one I am looking for 48 bit x 48 bit "signed integer divide" I see in the your math libraries 48/24 bit code but not 48/48. If there is non ...Is there any one willing to write/modify any existing signed integer divides such as the 32/32 signed divide given in the microchip math library Handbook ??????????????? Please email to me loui@g2a.net at your earliest convenience Louis Frias
Hello Everybody My query regarding PIC16F876 is how to go about ICSP...? I have the EPIC Plus Programmer. And despite making the corect connections, i get a message "Code Programming Error at 0000" .Is there a better way of accomplishing it? Regards Pankaj Dontamsetty, India
Hello Everybody My query regarding PIC16F876 is how to go about ICSP...? I have the EPIC Plus Programmer. And despite making the corect connections, i get a message "Code Programming Error at 0000" .Is there a better way of accomplishing it? Regards Pankaj Dontamsetty, India
bad watchdog?? I have the CLRWDT instruction into interruptions sequence but it loks like that don't have effect over watchdog. Pic 16c66 restart. What's the matter?
Hi everyone, I am a beginning with PICs and am working on a project transmitting GPS data. I want to modulate and lower the baud rate using a PIC12CE67. Does anyone have any advice or suggestions? Thanks alot, Steve
Hello my name is Daniel. i am new to pic16f84 processors but i have some assembly and routine knowledge. i already have a picBurner( i made it all by myself, i am very proud). I am currently build a robot i call "SmartBot". it is a disc shaped robot that controls two hacked servo's ( i am alright with the motor control bit). Now the part i am stuck on! I am wanting to use two 40Khz Ultrasonic Transducers to detect obstacles. I wish to mount these on another unmodified servo so that i can enable the robot to detect corners and go around them. Giving it a 180 degree sonar scanning radius. I have a few schematics of various transmit/recieve circuits for them, but i am lacking the knowledge to produce working code?? could anyone direct me to someone/where or could you please help me out? Email me Please! Thankyou all in Advance. Daniel
I need to find a program to run in windows that will take a hexadecimal program for a 16C84 and convert it to either assembler or C for me to understand. Is there one available?
I am using 16F877 for speed detector project. I am using Timer 1 to count the doppler frequency. I would like to have the code for capturing and converting to frequency. Since in counter mode, I will have to convert to frequency. I know its stored in TMR1H:TMR1L. Please help me out. I have to sent out to serial port. I already know how. Please mal me ---------Vijay = Amateur
in my program. using the 16f84. I am doing a timer loop waiting for an interupt. after I have serviced this interupt, i return to the timer in the timer loop. I do not want to return in the timer loop. I want to return to a specific place to re initialize the timer. how do I do this, or go about this. mgs_mos@yahoo.com
heres my question. When I am using the timer(tmr0), how do I have the timer(a long delay) running in the backgroud so I can do other tasks in the mean time. I am using a pic 16f84. below is code for a delay of 7 seconds thank you for you help marc sauveDly_dig bsf STATUS,5 movf OPTION_REG,w ;save option_reg movwf _option movlw b'01000111' movwf OPTION_REG & 0x07F bcf STATUS,5 movlw 0x02 ;ff ; Now, Display for a 7.28 Second @ 0x025 movwf Count movlw 0x02 ;ff movwf Countmid movlw 0x01 ;025 movwf Counthi ;------------- Dly_Loop decfsz Count goto Dly_Loop movlw 0x0ff movwf Count decfsz Countmid goto Dly_Loop movlw 2 ;0x0ff movwf Count movlw 1 ;0x0ff movwf Countmid decfsz Counthi goto Dly_Loop bsf STATUS,5 ;restore option_reg movf _option,w movwf OPTION_REG bcf STATUS,5 clrf INTCON BSF INTCON,3 BSF INTCON,7
I have a PIC16F873 that I need to reprogram with the Microchip Picstart plus programmer using MPLAB and I'm unable to reprogram it. I read a post from this archive who said to reprogram only the config bits and select protect ALL after reprogram the config bits by selecting protect OFF but it doesn't seems to work. I always get a failure message and the config bits don't program. If someone can help me it wil be very apreciate. sergetr@globetrotter.net
James Newton recommends:
http://www.piclist.com/techref/postbot.asp?by=time&id=piclist/2000/05/24/172733a&key=Picstart+plus+and+reprogram+and+16F873
[PIC):Hi , is there anybody who's specialized in I²C transmission of datas . I'm trying to make a program on the I²C bus for the irst time. The result is I don't get anything on the SCL (low state and noisy ) while there's a signal on the SDa line If there's somebody who can gimme a tip , it'd be great thanks
James Newton Answers: "You do have 4.7K pullup resistors to SDA and SCL
lines?"
Hello all, I'm new to the PIC scene but have a project that is a simple score counter. I'm trying to use a double digit LCD display with a PIC16c54c chip. The only input is an "up" button and a "down" button. I've already purshased a pic start programmer and have the componets. Any help with the code inorder for me to get started is greatly appreaciated. god bless and thanks
James Newton recommends:
http://www.piclist.com/techref/piclist/cheapic/worktime.htm
Hi to everyone, I'm using a PIC17C756A and serial eeprom 93C46 connect by SPI interface. I can read the memory but I can't write it. Somebody can help me to define the correct way to write eeprom and configure it ???. By the way, I use also AN613 of Microchip but it doesn't work. Thank to everyone, Fabrizio
Fabrizio was answered on the piclist at http://www.piclist.com/techref/postbot.asp?by=time&id=piclist/2001/08/26/063529a&key=93C46
I am using a PIC16F877 and a serial eeprom 25LC040 connect by SPI interface. I try to send to the eeprom 16 bytes of data but only the first data is written. Any idea? Thank to everyoneGRABAR_EE movlw 0x30 movwf addr movlw 0x10 ;nbytes = 16 movwf nbytes call WR_EE return WR_EE BANCO0 bcf PORTA,cs movlw 0x06 movwf outbyte call output bsf PORTA,cs ;Sequence WRSR BANCO0 bcf PORTA,cs movlw 0x01 movwf outbyte call output clrf outbyte ;BP1,BP0,WELL,WP=0 call output bsf PORTA,cs ;5ms: Internal Write Cycle Time call delay ;Sequence WREN BANCO0 bcf PORTA,cs movlw 0x06 movwf outbyte call output bsf PORTA,cs ;Sequence WRITE BANCO0 bcf PORTA,cs movlw 0x02 movwf outbyte call output movf addr,0 movwf outbyte call output movf txptr,0 movwf FSR ENV_REG movf INDF,0 movwf outbyte call output incf FSR,1 decfsz nbytes,1 goto ENV_REG bsf PORTA,cs call delay ;Sequence WRDI BANCO0 bcf PORTA,cs movlw 0x04 movwf outbyte call output bsf PORTA,cs retlw 0 ;*************************************************** ;* Subrutina SPI output * ;**************************************************** output movf outbyte,0 ;outbyte -> w movwf SSPBUF loop1 movlw SSPSTAT movwf FSR btfss INDF,BF goto loop1 movf SSPBUF,0 movwf rxdata retlw 0
I don't understand the concept of memory banks when programming the pic 16f84Could someone tell me the consequence of missing out the first line in the code snippet below
M1HI BSF STATUS,5 ;go to to page 1 (set bit 5 of status) BSF TRISA, 3 ;make RA3 an input (set bit 3 of trisa) BCF STATUS,5 ;back to page 0 (clear bit 5 of status) RETURN ;master 1 wire line highMany thanks for any reply Richard
I am looking for two thing regarding the PIC17C756A: 1. I need a circuit diagram for a programmer and compatible software. And 2. Can somebody tell me how to interface it with my pc via parallel port, or serial port, wichever is better. I need continuous communication, and fast.
Hi there, what has to be done inside the 16f877 to activate the RA4 and the RB3 ports for I/O ?, this is the same problem that 16F84 has with port RB0. I Hope someone Knows,Thanks.
hello, I'v to make a digital filter with a pic 16f876, using the pwm output as a digital to analogic signal, could you help me on it?, I use only MPLAB ASM Thanks Ben
Hi all!!! I used to program a PIC16f873 with assembler, so when using variables in different banks I had to switch them using RP0 and RP1. Now I have to program it with Hi-Tech C compiler, and I would like to know if I have to care about bank switching. Does the compiler recognise the location of every variable and automatically select the suitable bank???? I am going to use a buffer of 128 positions (the variables are going to be char), and this PIC just have 96 byte space in RAM data in every bank. Does the compiler divide the buffer and fit the parts into the different banks??? Thanks in advance.
hi all I have some problems in making the PIC16F877 receive an 8bit data using interrupt, it worked without interrupt, but when I make it interrupt driven it didn't, so any body help me on this. I need the code if some one has it. thanx in advance Bakry Yousif
I need your help in the PIC16F877 microcontroller USART mode. specifically in the receiver and how i can make it interrupt driven, note that it worked with me without interrupt "receiving all the time". if you have the code it will be more than nice thanx in advance yours Bakry Yousif
I am working on a project with the PIC 16F873. I found that when the watchdog time is enabled, I can not write any data to on-chip eeprom. Is this a bug or is it documented somewhere. Also are there any tricks to disable the watchdog timer in code?
Appologies in advance. I'm new to this PIC programming. I am running windows NT service pack 5 on a pentium s motherboard. Bios setting is SPP. Im using MPLAB IDE version (5.5) to edit and assemble the code. I am trying to use PICALL PRO windows version to Load the hex files into the chip. The software gives error at reset vector ooooh ("Code error"). Any body with what could be wrong. software really fully functional with PIC16f84 as advertised? (from: www.quasarelectronics.com/software.htm under kit 3117, 3081)
I am using a PIC16f87x microcontroller and i program from MPLAB using assembly codes. I am facing difficulty with configuring and interfacing the MSSP modulefor Master (receive /transmit)I2C serial communications.A beginner, I have followed the guidelines in their AN735 appln note and PIC16f87x datasheet. I need to communicate with other PICs but for a start I am trying to write data to a serial EEPROM. I get the interrupt after SEN bit set and I can write the control byte to EEPROM. But I cant see the serial clock even and data write is not successful.I have configured the following correctly 1. SSPADD : writes a value for 10 MHz clock and 100 KBpS data rate 2. sets SSPCONvalue to "3E"h 3. have followed the steps they give in their datasheet. 4. are not checking for write collision or bus collision. 5. checking the acknowlege flag, ACKSTAT after each byte write and will write next byte only if it is not set. 6. write protect of EEPROM is grounded 7. control byte of eeprom is correct 8. SCL and SDA pins of PIC are pulled up through external resistors. 9. direction of C port lines needed is correct ie as inputs 10. am setting SSPIE interrupt bit and GIE too. infact i get the interrupt after SEN bit set too. i wish to know the following. 1. is the BRG same for UART and I2C communication. 2. if i use UART for serial communication with PC aswell, will it make any problem in I2C communication? i need to use it and i have got the routines and codes for UART right already 3. any positve suggestions coming out of your experience? i would like to hear as early as possible please Achyuthan
Hi, I am urgently looking for away to generate a random number on a Pic12C509 but I need to make sure that when I switch three systems on at the same time not one of them will generate the same number. Is this possible? I am using the internal occilator of the Pic12C509. Thanks.
Hi, Does anyone know were I can find 64-bit (or v.good) maths routines for the PIC? Am looking for cos,sin,acos. I have seen some whilst searching called math1h.asm but the link failed! Thanks.
Is anyone else working with the ETT CP16F877 Development Board? When I first got the board, I was very impressed. It is ready for I2C EEPROM, DS1307 RTC, 232/422/485, onboard power supply, I/O header and software. Now I am past the checkout process and trying to develop. The in-circuit programming circuit appears to be tying up RB3. RB3 is pin 36 on the '877 40-pin version. It is used for low-voltage programming as well a general purpose I/O. The programming circuit has the output of a 74ls07 hex buffer, tied high with 10k ohms to Vcc. The input is tied low through 5.6k ohms. So RB3 stays low all the time! I wanted to use RB3 to toggle an LED on and off. With the hex buffer holding the line low, the LED is on all the time. My plan is to remove the 5.6k resistor and see if programming is affected. I welcome any comments on this development board, as well as solutions to my problem.
A PIC16F62x, USART and TX pin question: Can I use PB1/RX in async USART mode to receive from a serial line and use PB2/TX as a regular output pin at the same time? Or can I only use none or both as USART? How do I set the configuration bits? Thanks for any help! Matthias
Hi experts I'm currently trying to read external binaray switches state with the Port C of a 16F877 microcontroler. All is ok for C1 to C5 (C6 and C7) are used by the USART) but I can't get the info from C0 pin. Is there something that I didnt understand because I didn't read any limitations about this pin in the 16f877 datasheet ! Any help is welcome Vince
Hi, I am new in C programming and just bought a copy of HI-Tech V7.84 from a friend for testing. I very disappointed because I am interested in programming the Pic16F627/Pic16F628 pic's but the software I bought does not have the ability to do this. I have read the manual and came accross some interesting information that I can add my own pic's to the list of pic's. I have been trying this but my program just does not want to build succesfully. I have atleast found the latest pic.h file on the net but where can I or how do I get picinfo.h and the header file for the pic16f627.h or pic16f628.h so that I can add these two pic's to my list.
Could antone help me wit a simple coding problem. I am at the moments trying to configure a PIC 16F877 to do the following process. To read 2 potentiometers and depending on which way a switch is enabled, to do the A/D conversion and display the output on LED'S. I have managed the A/d conversion but how to configure the switch to one of the 2 inputs at a time is causing me problems. Any ideas
respected sir, i am working on pic16f628 series for designing of new electronic meter,but i am getting problem in using timer1 interrupt using internal rc oscillator,i have write proper contol words for intcon,pie1,pir1 reg. pls suggest some solution by providing a simple program for led blinking using timer1 int using internal rc osll.
i'm trying to use 24 bit floating point routines (AN575)from Microchip in 16F877. What should i change/add in "DEV_FAM.INC" so it works correctly? I've added the following but memory wrapped around. Thanks !! IFDEF __16F877 ; Generic Processor Type P16CXX SET TRUE ; If P16CXX, use INHX8M file format. P16_MAP1 SET TRUE ; ENDIF
I am using a pic16f876 to program. I use HiTech C Compiler. Now, i used spi model to control a shift register that is 74s164 to connect 8 leds. then i want to leds to display battery voltage that is input from RA2. i used following functions: void initUSART(void) void sendBytes9const char *) void sendByte(char c); void adc_read(unsigned char channel); how to program the microcontroller so that those leds can display battery voltage? Thanks
I'm new to programing and studing all the reference I can get about programing in MPASM. By trade I am a elecronic technician/engineer ,but have little programing experience. In any event, I am designing an application that uses the PIC16f872. The application Has one push button (MO) to controll the device. I want the button to have three function 1: low one short time .<.5sec, 2:low two short times ,<.5 sec., 3:low one long time > 2sec. Each function willl do a particular task. Any Ideals, would be greatly appreciated.
Hello, I'm attempting ADC on the 16F877. I am using the vref- and vref+ pins, and sampling AN1. I have voltage dividers set up at vref- and vref+ to give me 2v and 3.5v, respectively. My sample definitely swings from 2.5v to about 3v. I do not appear to be getting a reading. I'm using the FED PIC C compiler, and here's my code: http://www.jobie.com/87test.c#include <P16F877.h> #include <datalib.h> #include <delays.h> #define BS(a) (1<<a) void main( void ) { int NewValue, OldValue, i; TRISB = 0; TRISA = 0xff; OldValue = 0; i = 0; while(1) { // configure ADCON0 to read AN1 ADCON0 = BS(CHS0); // configure ADCON1 for right-justified result, using // vref+ and vref-, and reading the sample at AN1 ADCON1 = BS(ADFM) | BS(PCFG3); // let the internal capac stabilize Wait(30); // start the sampling ADCON0 |= ( BS(ADON) | BS(GO) ); // wait for completion while( (ADCON0 & BS(GO) ) ) { Wait(1); } // read the value NewValue = ADRESL + (ADRESH << 8); if ( NewValue > OldValue ) PORTB |= 4; else PORTB &= (~4); i++; if ( i % 2 ) PORTB |= 2; else PORTB &= (~2); OldValue = NewValue; } }The 2 lines from Port B are connected to LED's...one for a "heartbeat" (so I know the code hasn't crashed) and the other should go on as the value goes up, and off as it goes back down. I am 33 and nearly bald, so I don't have much more hair to pull out, so any help would be greatly appreciated! I'm sure it's something trivially stupid that I'm overlooking. (I usually experiment with the 16F84, so this is a new PIC for me.) Thanks in advance, John Nagle
Is there an absolute bottom limit to the frequency you can run a 16F84 at, I have seen ones operating at 20kHz, can the frequency be brung down lower to Hertz (~10Hz)?
Am having touble with the 40 pin version of Bojan Dobaj's PIC programmer, I built the 18 pin version and it works fine, the fourty pin ver however gives flakey results. The diagram shows R11 (680ohm) but the pcb has no holes for it..?? Without the resistor the LEDs all light correctly but the device will not read or program a PIC If I add the resistor it programs / reads correctly most of the time but the red LED (programming) no longer functions ! I have played with the value from 470ohm to 10K ohm and none work. Has anyone else had this problem? I have checked the board for the obvious and nothing shows up. I have 5v vcc and 13v vpp I did substitute the transistors (diag called for BC557) I used BC 308. Any idea's anyone ?? Please email direct....thanks for your thoughts. David.
Does anybody know if it it possible to control a SCSI-2 cd-rom drive (Toshiba xm-6210B) with a PIC such as pic16f628? I want to start stop select music songs (audio cd)
I want to design an ultrasonic driving circuit using frequency division multiplexing with my pic. The sending an dreceiving circuits are not a problemi would just like insight as to how i can break up the various signals into resective frequencies. Any help would be greatly appreciated
Hi, everybody. Does anyone have an experience implementing the meter-bus (m-bus) protocol with PIC microcontroller? If there are some hardware and/or software solutions, please, let me know. Thanks!
Hello, can somebody tell me how to use the buzzer on the millenuim board with a PIC 16f877 ? Can you point me to an example ? I want to have the buzzer on while a LED is on. thank you
Greetings! I am currently working on a wireless terminal using a 3x4 keypad + PIC16F877 + 4x16 LCD + x'mtter/r'cver modules TM1/RM1 c/o Glolab. The terminal communicates to a Server (w/ x'mtter/r'cver modules) to access an SQL database. My problem is im only a newbie w/ PIC's and i am still unable to start with the project. I am a NEWBIE in DESPERATE need of answers to the following: 1. How do i make the PIC read the keypad? I've seen some codes posted but they seem to be incomplete. MOST links are also dead. I figured that i could configure PORTB as b'00001110' and connect the 3 inputs to row and 4 outputs to col. The thing is i can only make the pic distinguish the row (1,4,7..). The 'lame' code i did was to set the RB7-RB4 and once a keypress on the 3x4 matrix is present, it would send a '1' to the inputs RB3-RB1. Please i DESPERATELY need help with this. What can i do to make it work? I am using MPLAB assembly. 2. What other problems will to encounter with my project? (wireless handheld terminal : PIC16F877 + 3x4 keypad matrix + LCD + wireless modules ) I hope i become less of a newbie after knowing the answers to these questions. Any form of help is greatly appreciated. Thanks and more power to www.piclist.com! PICLIST.COM has changed my life! Your site ROCKS mate'!
Hi everybody! I need schematic and source code for PIC pulse Up/Down counter on 7 segment LED display, and sch. and souce code of NiCd 12V battery charger (simple). Thanks! Denis
This is obviously something others have come across before, but I don't understand it. In PIC16C73 (and others) DECFSZ W,W seems to "not function" - it does not appear to subtract 1 from W, and skip next if zero. Why? The datasheet says DECFSZ can be 0 <F < 127, suggesting that it should work on W. I note that the automatic delay generator program (useful!) makes small delays (e.g. 120 cycles, what I am trying to do) using a scratch file register for DECFSZ work, so obviously they struck the same problem. Could anyone explain (a) if this doesn't work for a reason, and (b) suggest a similar timing system _without_ using scratch file register (ram is at a premium for my proggy...) Cheers Shamus Husheer Frustrated PIC beginner
Are there any linux programmers that will work with the PIC16PRO 40-pin version (kit CPS96 from Amazon Electronics). The prog84 webpage says it will work with most parallel programmers, but I want to be certain before I spend money on this kit.
I have decided to do "Room monitoring project" using sensors and PIC microcontroller. i.e. Consider a 16 ft x 16 ft room. I am dividing it into 4 quadrants and each quadrant will have lights. Whenever a person(s) enters the room if there is human presence in any quadrant then the lights in that quadrant turn on. For this I am thinking of using sensors and a PIC to control these activities. Also the PIC is to be interfaced to a PC where the user will be able to know the details i.e whether human presence is there in any quadrant. For this I am planning to use C language. Since I am new to PIC I am confused as to what configuration should I use. Also could you please give me some ideas that would help me in this project. Soma Sundaram
I'm doing vehicle type project by using PICf84a. Now, I face the key problem and need demo to solve it within three days. The problem is WHY my sending pulse cannot trigger PIC run proper routine. To specify it, While there is +5V voltage supplied to PortB(RB3), the looping subroutine runs correctly(one LED used to observe it). But, the LED1 will off when +5V was disconnected.WHY???
I'm using the pic16f876. I would like to use the i2c ports to interface to the SMBus. Is this possible? I'm under the impression that Intel took the i2c bus, made a couple changes, and called it a fancier name...the SMBus, (System managment Bus), and that the SMBus has the same basic set of specs as the i2c bus. Has anyone interface the i2c froma pic to the SMBus? Thanks.
Hi i am just starting into pic programing. I have my programer and pic 16f87 and am ready to start programing but there are a few things i am not sure of. #1 can you write the code for the pic in c++, or vb or is that just for interface. If not what are some good programs to write the code in. and #2 what programs do i use to program the chip or send the code to it. thanks for your help LR
Hello everybody, I want to write a programm in Pic Assembler which use the Fuzzy shell, is that possilbe? When it is, can you send a little programm with explainations to my mail adress. thx
1) Can anybody help me with the following info: I want to hard wire external components such as door contacts, passive infra reds and various alarm detectors into the pic via normal comms cable (4 core, 6 core etc). some people say that I should interface this via 47k resistors and a .1uf cap to gnd on every input pin, others say that the caps are not necessary , the reason that I am asking this is due to board size limitations. These wires can be ut to 50 meters long and are connected to normally closed contacts. 2) how close should the 4meg crystal be mounted to the ocs1&2 pins as I would like to mount it at the top end of the pic out of the way of the other components , or would this cause oscollation interference in the adjacent tracks. 3) on the mclr pin I have a 10k resistor and a diode in series coming from the 5v supply rail. I need to know what type of diode to use because I would like to be able to do in circuit programming. Eg can I use a 1n4148 or do I have to use a larger 1n4007 diode. 4 ) are there any sort of standard guidelines around when designing with pics (as in question one above) , a sort of dos and donts? as I cannot find anything in the data books about this. Also any interfacing from the outside world.? I would greatly appreciate your help on the above My e-mail is stag@freemail.absa.co.za Many thanks and best regards
Hello. At the moment I'm trying to make an RPM counter for elektromotors with an PIC16F84 controller. Because I have to measure very low RPM's, it it not possible to count the amount of pulses (I get 1 pulse per turn from the motor), but I have to measure the time between 2 pulses. To get a high accurancy i would have to fill the time between two pulses with 3 uS pulses (3 cycles at 4 MHZ clock). The only problem is my 8 bit register. How can I make an 19 bit register ?? Also an problem: After measuring 16.000.000 must be divided by the 19 bit pulse count and conversed to an 7-segment display. How can i do that ? Or does anybody have a piece of code which is capable of doing this. Thanks in previous !
This is my first time dealing with PIC. Im dealing with a project with title sounds Microcontroller based speed detection of moving object, Im intended to used PIC to do this project. I try to use two Infrared (IR) sensor for a distance, one at the beginning of the distance the other at the end of the distance which function as trigger switch to acknowledge the PIC to start counting and stop counting. The data (time or period) collected is manipulate by using speed equation Speed = Distance/Time the distance can have any given value (using keypad, the value of distance restrict to certain range due to the limitation of PIC) or my be a fixed the value. And then the result is display on a LCD display.
Hi, I am a beginner in PIC programming. Can anyone show me a simple program using i2C to transfer data from a 16C57 master to another 16C57 slave and vice-versa?
[PIC]:Hi , I'd like to make an operation on a 16-bit data (like an addwf)in assembler I was wondering if this could be possible since the registers in the 16c717 are 8-bit wide. So my question is : how can I make an operation on a 16-bit data( with the MSB and LSB) and then separate the 8 MSB datas and the 8 LSB datas so that I can store them in the SSPBUF register on the I²C bus? Thanks
[PIC]:HI everybody, I'd like to change the value of the datas I'm sending to the same component on the I²c bus, I 'd like to put a delay between the two (write-datas). but I have one problem . the value of the data remains in its first value or it goes directly to the second value. So the problem is that i can't the change occurring on the spectrum analyser( change of frequency) thanks for your answer
[PIC]: hi everybody, I have connected my PIC microcontroller(pic16c717) to a PLL (TSA5512 from philips). I have a signal on both SDA and SCL but there's no frquency coming out of my PLL (pin RF1) What 's that supposed to mean ? Thanks for answering me
Hi,I need help to program my pic to take a digtal reading off 7bits of portb (rB1-rB7)then convert them to an ascii number or BCD number from -10 to 50,and then display this number on a 16x2 line LCD display with 3 control lines and 8 data lines,any help greatly appreciated thanks.
Hello everybody, I need help to make an interface to a 12c eeprom (24AA256) with a pic 16F877, I have been trying with the code but nothing happens, i don´t know if I can write , or my problem is when I address , Do I need indirect addresing for writing, and for reading what should I do? If anyone cn give me any support I would appreciate it, please email me a37890@hotmail.com Thanks a lot
...I have posted a question in the PicList about a official file uploading/downloading zone.A example of a zone like this is the "Files" zone in the pages of egroups (now acquired by yahoo). By means of a web browser, every registered member can upload files. Each member has right to modify or erase only his files.Can add a description too. All files can be downloaded by any member.
Of course, the webmaster has right to erase files in case of deviations of use (in example, non-related files).
I think that binary files uploading is mandatory (for ZIPped files, images, schematics, etc.)
The interface based in a web browser is very ease to use, much more (I think) that send mails with tag topics or another text-based systems.
Well, its only a idea (not original).
Best wishes.
Alejandro Lavarello.
James Newton replys:
Alejandro, thanks for the input, file upload is in the works... as soon as I can find the time, I will implement it. It will also be integrated with the reply form on the archive postbot so that you can upload a binary and insert a link into your list post that refers to the binary. I hope to reduce list bandwidth and increase the use of pictures, etc.. by doing this.Anyone with NT 4 IIS 4 ASP VBScript or JScript programming experience who is willing is invited to help develop this functionality.
I am looking for a stand-alone programmer that will allow customers (non-technical) to perform firmware updates in the field. The device is the Microchip 16F877. The programmer would be required to use/match the onboard battery of the device. Can anyone help/recommend a programmer other than the Microchip products? Thanks Duane.
Tony Nixons
Pocket
Programmer is exactly what you want! Although it will require a LITTLE
ability on your customers part, or some clearly written instructions (e.g.
plug in the cable this way to this header, power up the programmer, select
"PROGRAM" then "DEVICE" then "16F877" then "FILE 1" then "GO"... or something
like that)
.The
Fobit (also made by Tony) is another possibility.
Comments:
Code:
+I am using a PIC 16F628 with a 2x16 LCD attached in 8 bit mode to PORTB. I also have 8 SPST buttons attached to PORTB. I read the switches and then do output to the LCD. The LCD output is corrupted by leftover latches/pin levels from the read. I am aware of the pitfalls of write/read sequences on a PIC port but I've tried every combination (except the right one !!!) to clear, reset, etc. If I eliminate the reading of the switches, the LCD routines work as they should. Some test code that I've written indicate that residual bits in the PORTB latches are getting or'd into the LCD output. How to I get rid of the residual bits from a PORTB read. Attached is the last version of the switch read code which by itself reads the switches correctly. Thanks Ted in Atlanta ; *************************************************************** ReadKeys: clrf PORTB bank1 ; All PORTB inputs movlw b'11111111' movwf TRISB PullUpOn ; Turn on pullups bank0 Deb: comf PORTB, W ; Compare against xorwf OldSwIn, W ; last accepted read bz Deb ; Will be zero till key is released clrf PORTB nop ReadAgn: comf PORTB, W ; Read all 1's as 0's movwf SwIn ; Save First read comf PORTB, W ; Read switches again xorwf SwIn, W ; Are 2 reads identical bnz ReadAgn movf SwIn, F ; Two reads are the same bz ReadAgn ; Branch if reads were no keys movwf OldSwIn clrf PORTB
Pat Johnson Says:
Hi guys! Does anyone have a method schematic and (code) for a PIC controlling a temp sensor for shutting down 120VAC, 20A circuit and perhaps using an LCD to set the over temp limits? accuracy 1 degree F from 100-120 degrees (120v in, 120v out to disable the output if the temp sensed is over the set limit)+
file: /Techref/piclist/q0.htm, 130KB, , updated: 2003/6/3 17:34, local time: 2024/11/24 13:07,
owner: SMT--MA5a,
3.133.138.129:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/techref/piclist/q0.htm"> PICList.com Questions:</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.