Tony Nixon [sales at picnpoke.com] of ICmicro's says:
This program will flash a LED from port pin RC4RC4 -> Led Anode Led Cathode -> 1K res 1K res -> ground ; Title "LED flasher." ; list P = 16F877 ; include "P16f877.inc" ; use definition file for 16F877 ; ; -------------------- ; USER RAM DEFINITIONS ; -------------------- ; CBLOCK 0x20 ; RAM starts at address 20h NaHi NaLo NbHi NbLo ENDC ; org 0x0000 ; start address = 0000h ; INITIALISE PORTS ; binary used to see individual pin level movlw b'00000000' ; all port pins = low movwf PORTA movlw b'00000000' movwf PORTB movlw b'00000000' movwf PORTC movlw b'00000000' movwf PORTD movlw b'00000000' movwf PORTE bsf STATUS,RP0 ; set RAM Page 1 for TRIS registers ; INITIALISE PORTS ; binary used to see individual pin IO status movlw b'00000000' ; all IO pins = outputs movwf TRISA movlw b'00000000' movwf TRISB movlw b'00000000' movwf TRISC movlw b'00000000' movwf TRISD movlw b'00000000' movwf TRISE movlw b'00000110' ; all analog pins = digital movwf ADCON1 bcf STATUS,RP0 ; back to RAM page 0 ; LED FLASH LOOP Loop bsf PORTC,4 ; RC4 = high = led on call Delay bcf PORTC,4 ; RC4 = low = led off call Delay goto Loop ; 1/2 SEC DELAY SUBROUTINE WITH 4MHz CLOCK Delay movlw 01h movwf NbHi movlw 03h movwf NbLo movlw 8Ah movwf NaHi movlw 5Bh movwf NaLo DeLoop0 decfsz NaLo,F goto DeLoop0 decfsz NaHi,F goto DeLoop0 decfsz NbLo,F goto DeLoop0 decfsz NbHi,F goto DeLoop0 ; return end
Hi, i too am new to programming pics. im trying to program the PIC16F877 to be a realtime clock and to output the time on an LCD display (pref 4 bit to the LCD) if anyone has code or knows where i can find an exmaple of a real time clock i would be so grateful. Im using MPlab to program so assmelby language rather than C or Basic, many thanks
i am a newbie in programming pics,the only pic that i have programmed is the 16F84.now i wish to move to a greater stuff - pic 16F877.Can someone PLEASE send me some good tutorial sites?
i'm a beginner in pic's programming, i say so because my question may sound silly, but here it comes, which electronics i need to make it up? Do you have the design?
Check the data sheet for the processor clock and power, then just add a 1Kohm resistor and LED between the IO pin to ground.
Found a formula to apply your delay routine to. It may not be 100% accurate, but it is really close. (12/Clock Frequency) = Delay/Steps Where steps are offset by 1. Such that 16Mhz clock would provide a delay of 750ms per step. If you required a delay of 500ms, you would need 666,666 steps. Convert 666,666 to Hex and you get 00 0A 2C 2A. Enter these values offset by 1, and you get NaHi=0x2D NaLo=0x2B NbHi=0x01 NbLo=0x0B Works for me.+
|file: /Techref/microchip/16F877/flashled.htm, 6KB, , updated: 2017/7/3 10:29, local time: 2018/12/11 15:58,
|©2018 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://www.piclist.com/techref/microchip/16F877/flashled.htm"> PIC Microcontoller Input / Ouput Method - Flash a LED from an 16F877</A>
|Did you find what you needed?|
PICList 2018 contributors:
o List host: MIT, Site host massmind.org, Top posters @20181211 RussellMc, Van Horn, David, Sean Breheny, David C Brown, Neil, Isaac M. Bavaresco, Bob Blick, Harold Hallikainen, AB Pearce - UKRI STFC, John Gardner,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
Welcome to www.piclist.com!