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.

Program to read A/D on firefly...

Status
Not open for further replies.
Here's the same code with 8MHz clock for better debugging speed. It has been tested and works perfect.
Code:
	LIST	p=16F88
	include "P16F88.inc"
	__config _CONFIG1, _WDT_OFF & _INTRC_IO & _MCLR_ON & _LVP_OFF
	ERRORLEVEL 0, -302

	cblock	0x20
	count
	endc

	banksel	TRISA 		;bank 1
	movlw	0x70		;8MHz clock
	movwf	OSCCON
	movlw 	B'00000010'
	movwf 	TRISA		;all outputs except RA1
	movwf	ANSEL
	movlw 	b'11000000'
	movwf 	ADCON1 
	banksel	PORTA		;bank 0
	movlw 	B'01001001'
	movwf 	ADCON0		; channel 0, FOSC/8, enable A/D
	bsf	STATUS,RP0
	movlw	0x70
	movwf	OSCCON
	bcf	STATUS,RP0
bleh	movlw 	0x06
	movwf 	count		;initialize count
loop	decfsz 	count,F 
	goto 	loop		;until finished
	bsf 	ADCON0,GO	;initiate conversion
test	btfsc 	ADCON0,GO	;conversion done?
	goto 	test		;not finished
	goto	bleh
	end
 
Last edited:
That's great. I saved the program, and I'll try it tomorrow night. Junebug is powering the firefly, so yellow should be on. The red LED means bad connection, so I unplug and reboot the system. Maybe that's why it's hanging. It was on nearly all the time, I'll have to watch for that.

I hope it's as simple as that.
 
My yellow LED is permanently on as I don't have the BS250 installed.

Mike.
 
Yes more experimentation to do yet. I get the feeling when I'm through with this project, I'll be a lot more knowledgeable about a whole lot of things.... But I won't stop until I have this thing up and running, and I will find out what the problem is.

I just got home from work, and first thing is to read my email and start MPLAB. As you might have noticed, I am sleep disfuntional, I sleep in spurts, two to four hours at the time. I often have time during the day to catch cat naps, and that only ascerbates the problem.

Nevertheless, back to PICking at my problem. Or should I say pecking at it... :)

Well, as soon as I plug it in, the red light goes on. I tried plugging and unplugging, the red light is on all the time. Red and yellow LEDs on all the time.
 
Last edited:
Well, as soon as I plug it in, the red light goes on. I tried plugging and unplugging, the red light is on all the time. Red and yellow LEDs on all the time.
I don't know if this is related, but it's worth a try. Go to the Debugger or Programmer menu (whichever you're set up to use at the moment) and hit "Download OS". That will download and reinstall the firmware in the PICkit 2/Junebug. Might fix that red light.

Also, before trying the above, try another USB port on the computer. If you have one kicking around, try a different USB cable too. Probably not it, but ya never know.
 
Last edited:
Did that. Downloaded OS, and changed USB port. Only have one cable, so can't do that. Red LED still on. The LED's have been acting up, sometimes the 12 LEDs on firefly would light up when I loaded the program, sometimes they did not.

Bill will have a look at it on Saturday, lucky me, I have the master himself to go to in times of trouble. :)
 
The PICkit2 seems to hate some Intel USB chipsets like the ones in my notebook. (Uses an Intel 82801FB/FBM USB chipset) I use a CF card to USB2.0 adapter and the problem went away.
 
12 should be 1-2.... sorry didn't mean to confuse you... :)


I have a compaq 900mhz, almost as good as a doorstop. But I fine tune it by running it lean and it goes reasonably fast. But it's time to upgrade, and I do want a laptop so I can work while I'm sitting in my truck waiting to get loaded or unloaded. I have plenty of time to use, so a laptop is my next computer, they're cheap nowadays, $600 will get you an Acer. I just don't like Vista at all, don't like the looks of it, and don't like the feel of it, and don't like what I hear about it.
 
Last edited:
IMHO VISTA SUX! I Sort of like the look of it but the feel and running and asking and asking and did i say asking ? lol its a pain in the booty.If you get a laptop i would recommend getting something downgradable because some newer laptops come with a vista only supported drivers like the mouse wont work on normal xp and stuff ... its sux. Good luck and remember :D Don't Click and Drive!
 
Vista just gives me a good reason to switch to Linux... I just might try switching over on my compaq once i have another.
 
Status
Not open for further replies.

Latest threads

Back
Top