PDA

View Full Version : I'm confused



Robotica1
- 14th July 2007, 15:59
I had to start a new thread as for some reason I cannot reply to the last one. When I try I get the message:
"You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
You are not logged in. Fill in the form at the bottom of this page and try again.
You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Log inUser Name:

Password:

Forgotten Your Password? Remember Me?


The administrator may have required you to register before you can view this page. "

I don't know what it's all about but here's that schematic...oh no it isn't..I can't do attachments...I get told that I am currently viewing as a guest etc (even though I am logged in...but can't reply to my own posts?!?!?) So I'll try my previous trick of posting this and then editing it to attach a schematic...fingers crossed

mackrackit
- 14th July 2007, 16:46
Maybe I am missing something but... code does not match schematic.


symbol l9= porta.1

symbol l10= porta.2

symbol l11= porta.3

symbol l12= porta.4

Drawing has:
A1 going to l10
A2 going to l11
and so on...Maybe I am the one confused:)

As far as you posting goes contact Darrel for help.

Robotica1
- 14th July 2007, 17:03
Yeah sorry about that....originally the port settings were as schematic: l9=a0, l10=a1, l11=a2, l12=a3. I changed them later to check that it wasn't just something with a0 but as a few of you pointed out I can't use a4 for I/O so I shifted 'em back. Maybe the code I sent was the middle test 'era' as it stands the last 4 port settings are a0-->a3 respectively. I've tested this setup on 3 PICs and 3 bargraphs (2 green and 1 red) with the same result. So I tried a6....same result. Out of pure frustration I wired the a0 output to a totally independant standalone LED...which flashes perfectly at the right time. This would make me think that the problem is with the Bargraph. But if I just pulse l9 then it is fine and if you look at the original code there are two subroutines (standard and pulse) which work absolutely fine. I cannot for the life of me see any reason whatsoever why one LED would work perfectly with a signal whereas another would flash ever so briefly with the same signal yet work fine when another signal comes from the same line....totally inexplicable and maximum admiration to anyone who can work this out!!!

mackrackit
- 14th July 2007, 17:41
Ok, Looking at the data sheet in section 11 VOLTAGE REFERENCE MODULE on page 68.


11.5 Connection Considerations
The Voltage Reference module operates independently
of the Comparator module. The output of the reference
generator may be connected to the RA2 pin if the
TRISA<2> bit is set and the VROE bit, VRCON<6>, is
set. Enabling the Voltage Reference module output onto
the RA2 pin with an input signal present will increase
current consumption. Connecting RA2 as a digital output
with VREF enabled will also increase current consumption.
The RA2 pin can be used as a simple D/A output with
limited drive capability. Due to the limited drive
capability, a buffer must be used in conjunction with the
Voltage Reference module output for external connections
to VREF. Figure 11-2 shows an example buffering
I am sure Mister-E can clear this up if it is the problem, now I am in new ground:(

Robotica1
- 14th July 2007, 18:06
Thanks Dave, (and mister_e and all who've contributed),
I have to go to bed now as it's 3am and my boy's B'day tomorrow (today)....looks like I won't get the full coding down for his 'wrist scanner'...I'll work it out later and 'upgrade' him. Thanks again for all your help and if anyone actually puzzles this out I'll be all ears as to what's happening.

Good night all

mister_e
- 14th July 2007, 18:27
The voltage reference is disabled by default, but yeah, not bad to make sure of everything
CVRCON = 0 if my memory serves me well

with CMCON = 7 it usually enough.

Anyways, on this one, IF we want to have always the same brightness on ALL LED, we will need to do some TRIS and PORT tricks. Obviously our friend omit to add the resistor in his schematic, but no problem, i'm working on something right now.

For once, i'll try it on a SIM :D :D :D

Schematic is attached

mister_e
- 14th July 2007, 19:50
OK, here's the overcomplicated solution first...


@ __CONFIG _INTRC_OSC_NOCLKOUT & _MCLRE_ON & _LVP_OFF & _WDT_OFF & _PWRTE_ON & _BODEN_ON
PORTA = 0
PORTB = 0
TRISA = 0
TRISB = 0
CMCON = 7

CounterA var byte
GOTO START
@ IFNDEF KAPOUET
PAUSE 0 ' include PAUSE?C macro
@ ENDIF
ASM


ON=1
OFF=0
BLINK=2

CLEARALL MACRO
VARIABLE CLEARCOUNTER
CLEARCOUNTER=1
WHILE (CLEARCOUNTER<13)
LED#v(CLEARCOUNTER) OFF
CLEARCOUNTER++=1
ENDW
ENDM

LED MACRO LEDOUT,ACTION,DELAY
IF (ACTION == BLINK)
LED#V(LEDOUT) ON
PAUSE?C DELAY
LED#V(LEDOUT) OFF
ELSE
LED#V(LEDOUT) ACTION
PAUSE?C DELAY
ENDIF
ENDM

LED1 MACRO ACTION
MOVE?CT 0,TRISB,0
MOVE?CT ACTION,PORTB,0
ENDM


LED2 MACRO ACTION
MOVE?CT 0, TRISB,1
MOVE?CT 0, TRISB,2
MOVE?CT ACTION,PORTB,1
MOVE?CT 0,PORTB,2
ENDM

LED3 MACRO ACTION
MOVE?CT 1, TRISB,1
MOVE?CT 0, TRISB,2
MOVE?CT ACTION, PORTB,2
ENDM

LED4 MACRO ACTION
MOVE?CT 0,TRISB,3
MOVE?CT ACTION,PORTB,3
ENDM

LED5 MACRO ACTION
MOVE?CT 0, TRISB,4
MOVE?CT 0, TRISB,5
MOVE?CT ACTION,PORTB,4
MOVE?CT 0,PORTB,5
ENDM

LED6 MACRO ACTION
MOVE?CT 1, TRISB,4
MOVE?CT 0, TRISB,5
MOVE?CT ACTION, PORTB,5
ENDM

LED7 MACRO ACTION
MOVE?CT 0, TRISB,6
MOVE?CT 0, TRISB,7
MOVE?CT ACTION,PORTB,6
MOVE?CT 0,PORTB,7
ENDM

LED8 MACRO ACTION
MOVE?CT 1, TRISB,6
MOVE?CT 0, TRISB,7
MOVE?CT ACTION, PORTB,7
ENDM

LED9 MACRO ACTION
MOVE?CT 0,TRISA,0
MOVE?CT ACTION,PORTA,0
ENDM

LED10 MACRO ACTION
MOVE?CT 0, TRISA,1
MOVE?CT 0, TRISA,2
MOVE?CT ACTION,PORTA,1
MOVE?CT 0,PORTA,2
ENDM

LED11 MACRO ACTION
MOVE?CT 1, TRISA,1
MOVE?CT 0, TRISA,2
MOVE?CT ACTION, PORTA,2
ENDM

LED12 MACRO ACTION
MOVE?CT 0,TRISA,3
MOVE?CT ACTION,PORTA,3
ENDM
ENDASM



START:
for countera =1 to 10
ASM
LED 1,ON,0
LED 4,ON,0
LED 7,ON,0
LED 10,ON,250
CLEARALL

LED 2,ON,0
LED 5,ON,0
LED 8,ON,0
LED 11,ON,250
CLEARALL

LED 3,ON,0
LED 6,ON,0
LED 9,ON,0
LED 12,ON,250
CLEARALL
ENDASM
next

FOR COUNTERA= 1 TO 10
asm
variable CLED
CLED=1

while (CLED<13)
LED CLED,BLINK,250
CLED++=1
ENDW
CLED=11
while (CLED>1)
LED CLED,BLINK,250
CLED--=1
ENDW
ENDASM
NEXT
GOTO START

now, i'll try to do something more 'user friendly :o

Robotica1
- 18th July 2007, 13:03
Thanks for all your help there and with my other posting re no attachments.