Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

hardware debouncing a switch

Status
Not open for further replies.

large_ghostman

Well-Known Member
Most Helpful Member
could someone show me a schematic and explain how hardware debouncing works on a pic pin with say a normaly open push button switch??
p.s i know software debounce is normaly used but i want to find out more about hardware debouncing
yes i can google but you all explain things better to me in a way i can understand thank you again lg
 
large arrays in c18 and near and far and constant ROM

hi can somone explain how i can set up large arrays on a 18f chip and what is near and far casting for?
thank you lg
 
Hi LG... firstly. I also only use software debouncing so I'm sure someone will help there.

Large arrays are created by editing the LKR script. You adjust the ram banks into the size you need and then you need to alias the section.

Code:
// File: 18f4620.lkr
// Sample linker script for the PIC18F4620 processor

LIBPATH .

FILES c018i.o
FILES clib.lib
FILES p18f4620.lib

CODEPAGE   NAME=page       START=0x			END=0xFFFF
CODEPAGE   NAME=idlocs     START=0x200000 	END=0x200007		PROTECTED
CODEPAGE   NAME=config     START=0x300000	END=0x30000D		PROTECTED
CODEPAGE   NAME=devid      START=0x3FFFFE	END=0x3FFFFF		PROTECTED
CODEPAGE   NAME=eedata     START=0xF00000	END=0xF003FF		PROTECTED

ACCESSBANK NAME=accessram  START=0x0		END=0x7F
DATABANK   NAME=gpr0       START=0x80		END=0xFF
DATABANK   NAME=gpr1       START=0x100		END=0x1FF
DATABANK   NAME=big        START=0x200		END=0x7FF	PROTECTED <-----heres the large array
DATABANK   NAME=gpr8       START=0x800		END=0x8FF
DATABANK   NAME=gpr9       START=0x900		END=0x9FF
DATABANK   NAME=gpr10      START=0xA00		END=0xAFF
DATABANK   NAME=gpr11      START=0xB00		END=0xBFF
DATABANK   NAME=gpr12      START=0xC00		END=0xCFF
DATABANK   NAME=gpr13      START=0xD00		END=0xDFF
DATABANK   NAME=gpr14      START=0xE00		END=0xEFF
DATABANK   NAME=gpr15      START=0xF00		END=0xF7F
ACCESSBANK NAME=accesssfr  START=0xF80		END=0xFFF	PROTECTED

SECTION    NAME=CONFIG     ROM=config
SECTION    NAME=buffer_scn RAM=big

STACK SIZE=0x100 RAM=gpr14

as you can see I've created a ram buffer buffer_scn for a linear 1k buffer.. Then you just create the pointer in your code.

Code:
#pragma udata buffer_scn
static char buffer[1024];
#pragma udata

char * backbuffer = &buffer[0];

That is my screen buffer for a 128x64 LCD screen.

Near pointers are pointers to memory within the current data memory bank.... Far pointers are for accessing all data memory banks. Constant rom pointers are for code memory.

I hope this helps...
 
Last edited:
that looks complicated i will have to study that a bit thank you for the info so can i use different linker scripts for the same chip depending on what i want to do, i mean can i build a sort of library of scripts for each chip i want to use?
thanks lg
 
thank you all for the information the link was dead tho mr be80be as for the arrays i will probaly need more help soon with that if thats ok
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top