Storing Cookies (See : http://ec.europa.eu/ipg/basics/legal/cookies/index_en.htm ) help us to bring you our services at overunity.com . If you use this website and our services you declare yourself okay with using cookies .More Infos here:
https://overunity.com/5553/privacy-policy/
If you do not agree with storing cookies, please LEAVE this website now. From the 25th of May 2018, every existing user has to accept the GDPR agreement at first login. If a user is unwilling to accept the GDPR, he should email us and request to erase his account. Many thanks for your understanding

User Menu

Custom Search

Author Topic: Feedback To Source  (Read 387371 times)

Groundloop

  • TPU-Elite
  • Hero Member
  • *******
  • Posts: 1736
Re: Feedback To Source
« Reply #765 on: April 27, 2011, 12:35:37 AM »
@groundloop

I have the pickit2 board and programmer. Can I put the pic16F88 on the pickit2 board and reprogram the pic controller with one of your downloaded files?

If so which one I must try first?

Jesus

Jesus,

Forget about programming the PIC for a while. The board is ready to run and has been
tested OK before I sent it to you. Your first task should be getting the communication
between the board and you PC going so that you can use the board in you settings.

The functions of the board is controlled from a menu shown in the Hyperterminal.
You should focus on getting this to work first. Without this communication the board
is of no use at all.

You can always start to change the program code later on when you have checked
out the board functions and want the board to behave differently than I have programmed it.

Please get the Hyperterminal communication between the board and you PC going first.
Did you try to connect and disconnect the battery several times when the board was connected
and the Hyperterminal was running and connected to the board via the USB dongle?

Groundloop.

nievesoliveras

  • elite_member
  • Hero Member
  • ******
  • Posts: 1996
Re: Feedback To Source
« Reply #766 on: April 27, 2011, 09:17:25 AM »
@groundloop

I found that the battery's negative wire, even though it seemed well connected, was broken inside. I repaired it and the result is on the graphic.

Jesus

Groundloop

  • TPU-Elite
  • Hero Member
  • *******
  • Posts: 1736
Re: Feedback To Source
« Reply #767 on: April 27, 2011, 09:44:16 AM »
Jesus,

Great now you have the switch ready to be used.

Try connecting a LED in series with a 330 Ohm resistor
to the switch connector + on LED on pin 1 on connector.
The resistor (in series with the - on LED) to ground.
(Ground on the connector has a black marking.)

Then run the switch and adjust frequency etc. from the Hyperterminal menu.

Groundloop.

nievesoliveras

  • elite_member
  • Hero Member
  • ******
  • Posts: 1996
Re: Feedback To Source
« Reply #768 on: April 27, 2011, 09:55:33 AM »
Jesus,

Great now you have the switch ready to be used.

Try connecting a LED in series with a 330 Ohm resistor
to the switch connector + on LED on pin 1 on connector.
The resistor (in series with the - on LED) to ground.
(Ground on the connector has a black marking.)

Then run the switch and adjust frequency etc. from the Hyperterminal menu.

Groundloop.

Thank you @groundloop!

I will try it tomorrow during the day.

Jesus

nievesoliveras

  • elite_member
  • Hero Member
  • ******
  • Posts: 1996
Re: Feedback To Source
« Reply #769 on: April 27, 2011, 04:02:10 PM »
@groundloop

I just finished testing the board.

I put 2 Leds with their respective resistors on the three way connector.
One was a green led, the other a big hat led (it was what I had available)

They worked well for a few minutes then they just stop working. First the green one, then the big hat. I checked with my led checker and they are blown.

Before this happened I press the number 5 to put the program on auto run, then I tried the number seven to see if it increased the frequency and it had no visible increase on flashing speed.

I tried a couple of times hitting number 8 to decrease the speed and it also does not decrease the speed of flashings.

Suddenly the green one stop working, the big hat followed after a few seconds.

Jesus

Groundloop

  • TPU-Elite
  • Hero Member
  • *******
  • Posts: 1736
Re: Feedback To Source
« Reply #770 on: April 27, 2011, 08:29:01 PM »
@groundloop

I just finished testing the board.

I put 2 Leds with their respective resistors on the three way connector.
One was a green led, the other a big hat led (it was what I had available)

They worked well for a few minutes then they just stop working. First the green one, then the big hat. I checked with my led checker and they are blown.

Before this happened I press the number 5 to put the program on auto run, then I tried the number seven to see if it increased the frequency and it had no visible increase on flashing speed.

I tried a couple of times hitting number 8 to decrease the speed and it also does not decrease the speed of flashings.

Suddenly the green one stop working, the big hat followed after a few seconds.

Jesus

Jesus,

Did you connect the two LEDs as shown in the attached drawing?
Also, was the two resistors 330  Ohm?

Groundloop.

nievesoliveras

  • elite_member
  • Hero Member
  • ******
  • Posts: 1996
Re: Feedback To Source
« Reply #771 on: April 28, 2011, 03:09:32 AM »
@groundloop

I connected it just like that.

Before I throw any part to the gabage can, I check it.  I did so with the Leds and found that they are still working but barely visible.
I fear that the optocoupler behave the same way when I get it from the supplier. It has a led inside.

So maybe it is better to use the board with some mosfets or 2n3055 instead.

Jesus

Groundloop

  • TPU-Elite
  • Hero Member
  • *******
  • Posts: 1736
Re: Feedback To Source
« Reply #772 on: April 28, 2011, 05:13:31 AM »
@groundloop

I connected it just like that.

Before I throw any part to the gabage can, I check it.  I did so with the Leds and found that they are still working but barely visible.
I fear that the optocoupler behave the same way when I get it from the supplier. It has a led inside.

So maybe it is better to use the board with some mosfets or 2n3055 instead.

Jesus

Jesus,

I find it very hard to belive that the small 5 volt output from the PIC can damage
LEDs if you used 330  Ohm resistors in series with each LED and connected
like in my last drawing. 5 Volt / 330 = 15mA. Normal LEDs can handle approx. 20mA.

Did you check if the 9 volt battery went dead?

Does the on-board withe LED still work?

It is not a problem to use opto couplers on a PIC as long as the series resistors
is correct in value.

Groundloop.
« Last Edit: April 28, 2011, 05:34:22 AM by Groundloop »

nievesoliveras

  • elite_member
  • Hero Member
  • ******
  • Posts: 1996
Re: Feedback To Source
« Reply #773 on: April 28, 2011, 11:39:02 AM »
The 9v battery is ok. The on board white led turns on steady when I press #1. It goes off when I press #2. If I press #3 it goes on steady again. If I press #4 It goes out again.

If I press #5 it begins to flash without stopping. If I press #6 it stops flashing.  If I press #5 then #7 nothing happens or if I press #5 and #8 nothing happens. (with #5 then #7 or #5 then #8 it keeps flashing at the same rate visually)

Jesus

nievesoliveras

  • elite_member
  • Hero Member
  • ******
  • Posts: 1996
Re: Feedback To Source
« Reply #774 on: April 28, 2011, 11:40:32 AM »
I would like to know how to add a code that substract 10 from the timer value each time I press the #7 with an if/then to put the timer value to 10 if the timer value is less than 0.

Also I would like to add a code that adds 10 to the timer each time I press #8 with no upper limit.

Is that possible?

Jesus

nievesoliveras

  • elite_member
  • Hero Member
  • ******
  • Posts: 1996
Re: Feedback To Source
« Reply #775 on: April 28, 2011, 02:42:51 PM »
Maybe I am wrong. But I think that the increase and decrease problem is on this code part:

Jesus

Groundloop

  • TPU-Elite
  • Hero Member
  • *******
  • Posts: 1736
Re: Feedback To Source
« Reply #776 on: April 28, 2011, 03:30:39 PM »
Maybe I am wrong. But I think that the increase and decrease problem is on this code part:

Jesus

Jesus,

If you keep the frequency up (or down) button pressed by holding the button down for a while
then you will see change in the on board LED frequency. It just take a little time to see. Also
if you have a o-scope you can scope the pulse output. There is nothing wrong with the code
because I have checked it before you got the board.

The frequency is a delay subroutine and uses two 8 bit register to form a 16 bit word.
So if you want to increase (or decrease) the frequency by 10 then you need to subtract 10
from the 16 bit word to increase frequency and add 10 to the 16 bit word to decrease the frequency.

The PIC16F88 is a 8 bit micro controller so you will need to make a subroutine that you want
to name add16 and you need a subroutine named sub16. Like this:

;***********************************************************************************
;* 16 bit add
;* adds a 2-byte value with a 2-byte value.
;* Input : AARGB0, AARGB1 + BARGB0, BARGB1
;* Output: AARGB0, AARGB1 17. bit in STATUS,0
;***********************************************************************************
add16         MOVF    BARGB1,W      ; Get low byte
            ADDWF   AARGB1,F      ; Add to destination
            MOVF    BARGB0,W      ; Get high byte
            BTFSC   STATUS,0      ; Check for carry
            INCF    BARGB0,W      ; Add one for carry
            ADDWF   AARGB0,F      ; Add high byte into DST
            RETURN
;***********************************************************************************

;*****************************************************************************
;* 16 bit sub
;* subs a 2-byte value with a 2-byte value.
;* Input : AARGB0, AARGB1 - BARGB0, BARGB1
;* Output: AARGB0, AARGB1 IF STATUS,0 is set then carry.
;*****************************************************************************
sub16        movf     BARGB1,W        ; Get low byte of subtrahend
                subwf    AARGB1,F         ; Subtract DST(low) - SRC(low)
                movf     BARGB0,W         ; Now get high byte of subtrahend
                btfss    STATUS,0            ; If there was a borrow, rather than
                incf     BARGB0,W          ; decrement high byte of dst we inc src
                subwf    AARGB0,F         ; Subtract the high byte and we're done.
                return
;*****************************************************************************

Now, these two subroutines uses some new byte variables (RAM variables) that need to be
declared in the top of the program in the CBLOCK part.

Insert:

AARGB0
AARGB1
BARGB0
BARGB1

Now the two new subroutines is ready to be used. Now you can mov the two 8 bit counters
into the match variables, call the sub16 or add16, and then mov the result back into the two
delay registers. This will increase the frequency by 10 or decrease the frequency by 10.

How to do that I leave to you because you need to learn how to make programs.

Groundloop.

nievesoliveras

  • elite_member
  • Hero Member
  • ******
  • Posts: 1996
Re: Feedback To Source
« Reply #777 on: April 29, 2011, 03:07:11 AM »
Thank you @groundloop!

It is one of my goals, to learn to write useful programs.

Jesus

nievesoliveras

  • elite_member
  • Hero Member
  • ******
  • Posts: 1996
Re: Feedback To Source
« Reply #778 on: May 01, 2011, 02:19:12 PM »
Using @groundloop's code for the two outputs board, with basic and without using the hyperterminal I made this program in order to use the board without a PC.

The simulation gif file can be downloaded here: http://www.overunity.com/index.php?action=downloads;sa=view;down=468

Jesus

nievesoliveras

  • elite_member
  • Hero Member
  • ******
  • Posts: 1996
Re: Feedback To Source
« Reply #779 on: May 05, 2011, 05:05:00 AM »
I have found problems to get the right parts.

Jesus