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.

Pic Code For Time Fountian

Status
Not open for further replies.

atntias

New Member
Hi, im working on a time fountain and im starting to write the pic code, i just started learning assembler through some tutorials.

i tried to write a program that when RA1 is high then led on rb3 goes high,
i connected the circuit like in the picture and wrote this program.

i know forsure that all connection are good since i burnt the pic with a led blinking file and it worked. as for the switches i soldered them well and they should work but i haven't seen them work yet.


list p=16F84
radix hex
;-------------------------------------------
STATUS equ 03h
TRISA equ 85h
TRISB equ 86h
PORTA equ 05h
PORTB equ 06h
;-------------------------------------------
bsf STATUS,5 ;Switch to Bank 1
movlw b'11111'
movwf TRISA ;Set the Port A pins to input
movlw b'00000000'
movwf TRISB
bcf STATUS,5 ;Switch to Bank 0

Start BTFSS PORTA,1
goto LedOff
movlw b'11111111' ;Turn the LED ON
movwf PORTB
goto Start

LedOff movlw b'00000000' ;Turn the LED OFF
movwf PORTB
goto Start


end


can any1 help?
 

Attachments

  • pic.png
    pic.png
    6.9 KB · Views: 186
if your using a switch you probably need to debounce it there a lot of ways to do it search the forum its a sure thing that it had been discussed before,

the way i do it is pass the signal from the switch through a buffer that usually works.

good luck
 
damn it

hi agian,
ok so i have no idea what wrong i cant write anything that works.
im using mplab, and everything compiles well but not even the simplest program works. when i burn the pic with not-made-by-me files it works. but nothing i compile works.
here is exactly what im compiling why dosnt it set 7 port b pins high

list p=16f84a

;-------------------------------------------
STATUS equ 03h
TRISB equ 86h
PORTB equ 06h
;-------------------------------------------

bsf STATUS,5 ;Switch to Bank 1
movlw 00h
movwf TRISB
bcf STATUS,5 ;Switch to Bank 0

Start
movlw 7Fh
movwf PORTB
goto Start


end
 
You need to set the config file. See **broken link removed** for an explanation.

Basically you need a line such as,
Code:
	__config   _XT_OSC & _WDT_OFF & _PWRTE _ON & _CP_OFF
for it to work.

This also means that you need to include the definition file.
Code:
	include	"p16f84a.inc"

Mike.
 
hi again.
so is this code including the drop sensor?
it will be great,if u post the full details of the project.
regards.
 
hi, no the code above is nothing, but im working on the code and im learning alot, im already working with interupts, table, buttuns, leds, and sensor.

thing are going great, it will take some time until i finish it.
 
great news

hi guys, code is coming up real nice so far i have reached drop in mid air results very nicely. im not using any motor controlling this is drop sensor based only which is good enough.

so far what im doing is waiting X time after drop is detected and turning leds on for Y time doing that Z times until next drop. X determines the location of the drop and can be easily calculated with X=0.5gt^2 (x=in cm g=9.8 t=resulting time).
Y and Z on the other hand is a how long to turn on the leds and how many times to do that between 2 drops. hard ones to tackle since Y needs to be just long enough to see and Z needs to be determined by the drop rate.

now this is just the drop in mid air effect, after this is perfected theres still work on other effects, i will add reverse&slow motion. and also number of drop seen.

i will post my questions regarding the effect and variables on physics/math forum.
 
cool thats some nice info.
and i think controlling motor is just waste of time.if we control the drops...like 10 drops per sec and using the drop sensor,one can make some real good effects.

i am desperately waiting for ur results.once u finish pls do update for us.
regards.
 
today i was browsing nate's blog for some clarifications.and found that he started a new thread regarding the assembly.
http://cre.ations.net/creation/assembling-your-time-fountain
and this time,he posted complete circuit and code(hex to burn).
but the code is for sensor with DC pump.pump will also get controlled by PIC.

i think pic which can control the led using drop sensor will be enough.bcz we(i) found out that small pumps are available (mostly) in AC but not DC.

@atntias
i think ur also working in the same way.i mean AC pump with drop sensor.
and in the above article at the bottom he explained abt using the button to control the flow direction.
i almost finished planning my mechanical fitments.i want to make it look good.
 
progress!

ok so theres good news, i moved to programming in basic and with the 16f628a not 84.
and since i have a close desgine i decided to indeed use a dc motor with pwm.
ask me why not use code already exiisting, thats just cus im like that i want to have my owm interface. :)

if ur intrested il post all the code i have on the 16f84a that was tested and worked... it has work to be done on it but if u want it just say so...
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top