Jump to content
Sign in to follow this  
hmm

I Need Help Pro Programmers

Recommended Posts

i need a program for my binary counting with this conditions at hand:

 

when it count 1, a light will lit and always on until 9 but when reaches 0 it will turn off

counts up and down 0-9, 9-0

stops counting when reaches 0 or 9

sensors has 2 lasers as transmitters and 2 LDRs as recievers

4 pins of port b is used and will be connected to a 74LS47

the sensors will not count as long as it is not verified by the other sensor

 

thanks for your help, i really need it

 

stud boy studying pic

Share this post


Link to post
Share on other sites

Sounds like a business trying to make a knockoff of a visitor-counter.

Maybe you should ask for more cac001.

Share this post


Link to post
Share on other sites

a professor of mine gave me a flow chart of my project yet, its not fully finished... i needed the part to make count up and down.... im using 16F84.... so, RB0-RB3 are outputs connected to a 7447 decoder....

 

im just in need of help... im not that good in making a program....

Share this post


Link to post
Share on other sites

Counting is usually one of the first things people learn when programming ...

There are many examples in ra68gi's beginner thread.

 

But here is the one way to do a basic up-down counter:

 

if((count==0)||(count==9))
{
   LED = OFF;
   direction ^=1;
}
else
{
   LED = ON;
}

(direction)?(count--):(count++);

Share this post


Link to post
Share on other sites
i need a program for my binary counting ...

I need $50.00.

Which will get what they need sooner?

cac001,

I will give you $100.00 if you write a code from what he has described.

 

Raghunathan.

 

Here the assembly code:

;  Port pin assignments:
;
;  RA0 - OUTPUT (not used)
;  RA1 - OUTPUT (not used)
;  RA2 - OUTPUT (not used)
;  RA3 - OUTPUT (not used)
;  RA4 - OUTPUT (not used) Open drain output
;  
;  RB0 - OUTPUT (BCD bit 0)
;  RB1 - OUTPUT (BCD bit 1)
;  RB2 - OUTPUT (BCD bit 2)
;  RB3 - OUTPUT (BCD bit 3)
;  RB4 - INPUT  (LDR 1)     0=light detected, 1=no light
;  RB5 - INPUT  (LDR 2)     0=light detected, 1=no light 
;  RB6 - OUTPUT (not used)
;  RB7 - OUTPUT (LIGHT)     0=Count is zero light off, 1=Count is non-zero light on
;
;      State transitions:
; STATE LDR1  LDR2   ACTION
;   0   0     0     Idle state, light present on both detectors
;
;   1   0-1   0     Arm detect on LDR2
;   2   1     0-1   Detect on LDR2, count up  , clear detect timer
;   3   1-0   0-1   Detect on LDR2, count up  , clear detect timer
;
;   4   0-1   0-1   Indetermanant, clear detect timer
;
;   5   0     0-1   Arm detect on LDR1
;   6   0-1   1     Detect on LDR1, count down, clear detect timer
;   7   0-1   1-0   Detect on LDR1, count down, clear detect timer
;
;   8   1-0   0     Idle state, light present on both detectors, clear detect timer
;   9   0     1-0   Idle state, light present on both detectors, clear detect timer
;  10   1-0   1-0   Idle state, light present on both detectors, clear detect timer
;
;  11   1     1     Idle state, no light present on both detectors
;
; To use the MPLAB simulator you will need 
; the VC.SBS stimulus workbook file.
;
       list p=16F84A       
       __config 03FF9H

       GOTO 0xbb       
       ADDLW 0xff      
       ADDLW 0xff      
       ADDLW 0xff      
       MOVWF 0x4f      
       SWAPF 0x3, W    
       BCF 0x3, 0x5    
       MOVWF 0xc       
       SWAPF 0xa, W    
       MOVWF 0xd       
       SWAPF 0x4, W    
       MOVWF 0xe       
       BCF 0xa, 0x3    
       BCF 0xa, 0x4    
       GOTO 0xc1       
       ADDLW 0xff      
       BCF 0x3, 0x5    
       CLRF 0x19       
       BTFSS 0xb, 0x5  
       GOTO 0x22       
       BTFSS 0xb, 0x2  
       GOTO 0x22       
       BCF 0xb, 0x2    
       MOVLW 0x9       
       ADDWF 0x1, F    
       DECF 0x10, F    
       BTFSS 0x3, 0x2  
       GOTO 0x21       
       MOVLW 0x8       
       MOVWF 0x10      
       MOVF 0x11, F    
       BTFSS 0x3, 0x2  
       DECF 0x11, F    
       INCF 0x19, F    
       MOVF 0x19, W    
       MOVWF 0x1a      
       RETURN          
       BCF 0x3, 0x5    
       CLRF 0x19       
       BTFSS 0xb, 0x3  
       GOTO 0x77       
       BTFSS 0xb, 0    
       GOTO 0x77       
       MOVLW 0x30      
       ANDWF 0x6, W    
       MOVWF 0x12      
       BCF 0xb, 0      
       MOVF 0x12, W    
       XORWF 0x13, W   
       MOVWF 0x14      
       MOVLW 0x30      
       ANDWF 0x14, F   
       MOVF 0x14, F    
       BTFSC 0x3, 0x2  
       GOTO 0x76       
       MOVF 0x15, F    
       BTFSC 0x3, 0x2  
       GOTO 0x68       
       BTFSS 0x15, 0x4 
       GOTO 0x4f       
       BTFSS 0x14, 0x4 
       GOTO 0x4f       
       BTFSS 0x12, 0x4 
       GOTO 0x4f       
       MOVLW 0xf       
       ANDWF 0x13, W   
       SUBLW 0         
       BTFSC 0x3, 0    
       GOTO 0x4f       
       DECF 0x13, F    
       MOVLW 0xf       
       ANDWF 0x13, W   
       BTFSC 0x3, 0x2  
       GOTO 0x4c       
       BSF 0x13, 0x7   
       GOTO 0x4d       
       BCF 0x13, 0x7   
       MOVF 0x13, W    
       MOVWF 0x6      ; put break point here to monitor count decrement
       BTFSS 0x15, 0x5 
       GOTO 0x66       
       BTFSS 0x14, 0x5 
       GOTO 0x66       
       BTFSS 0x12, 0x5 
       GOTO 0x66       
       MOVLW 0xf       
       ANDWF 0x13, W   
       MOVWF 0x1a      
       MOVLW 0x9       
       SUBWF 0x1a, W   
       BTFSC 0x3, 0    
       GOTO 0x66       
       INCF 0x13, F    
       MOVLW 0xf       
       ANDWF 0x13, W   
       BTFSC 0x3, 0x2  
       GOTO 0x63       
       BSF 0x13, 0x7   
       GOTO 0x64       
       BCF 0x13, 0x7   
       MOVF 0x13, W    
       MOVWF 0x6      ; put break point here to monitor count increment
       CLRF 0x15       
       GOTO 0x74       
       BTFSS 0x14, 0x4 
       GOTO 0x6e       
       BTFSS 0x12, 0x4 
       GOTO 0x6e       
       BTFSS 0x12, 0x5 
       BSF 0x15, 0x5   
       BTFSS 0x14, 0x5 
       GOTO 0x74       
       BTFSS 0x12, 0x5 
       GOTO 0x74       
       BTFSS 0x12, 0x4 
       BSF 0x15, 0x4   
       MOVF 0x14, W    
       XORWF 0x13, F   
       INCF 0x19, F    
       MOVF 0x19, W    
       MOVWF 0x1a      
       RETURN          
       BCF 0x3, 0x5    
       BCF 0xb, 0x5    
       BCF 0xb, 0x2    
       MOVLW 0x9       
       MOVWF 0x1       
       MOVLW 0x8       
       MOVWF 0x10      
       CLRF 0x11       
       BSF 0xb, 0x5    
       RETURN          
       BCF 0x3, 0x5    
       BCF 0xb, 0x3    
       BCF 0xb, 0      
       MOVLW 0x30      
       BSF 0x3, 0x5    
       MOVWF 0x6       
       MOVLW 0x30      
       BCF 0x3, 0x5    
       ANDWF 0x6, W    
       MOVWF 0x12      
       BCF 0xb, 0      
       MOVF 0x12, W    
       MOVWF 0x13      
       CLRF 0x14       
       CLRF 0x15       
       BCF 0x13, 0x7   
       MOVF 0x13, W    
       MOVWF 0x6       
       BSF 0xb, 0x3    
       RETURN          
       BSF 0x3, 0x5    
       CLRF 0x5        
       BCF 0x3, 0x5    
       CLRF 0x5        
       MOVLW 0x30      
       BSF 0x3, 0x5    
       MOVWF 0x6       
       BCF 0x3, 0x5    
       CLRF 0x6        
       MOVLW 0x5e      
       BSF 0x3, 0x5    
       MOVWF 0x1       
       BCF 0x3, 0x5    
       BCF 0xb, 0x7    
       CALL 0x7a       
       CALL 0x84       
       BSF 0xb, 0x7    
       CLRF 0x5        
       CLRF 0x16       
       CLRF 0x17       
       MOVF 0x16, F    
       BTFSC 0x3, 0x2  
       DECF 0x17, F    
       DECF 0x16, F    
       CLRF 0x18       
       MOVF 0x18, F    
       BTFSS 0x3, 0x2  
       GOTO 0xb9       
       MOVLW 0x64      
       MOVWF 0x18      
       INCF 0x16, F    
       BTFSC 0x3, 0x2  
       INCF 0x17, F    
       DECF 0x18, F    
       GOTO 0xb1       
       BCF 0x3, 0x5    
       BCF 0xf, 0      
       BCF 0xf, 0x1    
       BCF 0xa, 0x3    
       BCF 0xa, 0x4    
       GOTO 0x98       
       CALL 0x10       
       MOVF 0x1a, F    
       BTFSS 0x3, 0x2  
       GOTO 0xcb       
       CALL 0x25       
       MOVF 0x1a, F    
       BTFSS 0x3, 0x2  
       GOTO 0xcb       
       MOVLW 0xaf      
       ANDWF 0xb, F    
       SWAPF 0xe, W    
       MOVWF 0x4       
       SWAPF 0xd, W    
       MOVWF 0xa       
       SWAPF 0xc, W    
       MOVWF 0x3       
       SWAPF 0x4f, F   
       SWAPF 0x4f, W   
       RETFIE          

       END

 

Here is the VC.SBS stimulus file for MPLAB:

## SCL Builder Setup File: Do not edit!!

## VERSION: 3.51.00.00
## FORMAT:  v2.00.00
## DEVICE:  PIC16F84A

## PINREGACTIONS
ms
200
RB5
RB4
--
0
0
0
--
10
0
1
--
20
1
1
--
30
1
0
--
40
0
0
--
100
0
1
--
110
1
1
--
120
1
0
--
130
0
0
--
200
0
1
--
210
1
1
--
220
1
0
--
230
0
0
--
300
0
1
--
310
1
1
--
320
1
0
--
330
0
0
--
400
0
1
--
410
1
1
--
420
1
0
--
430
0
0
--
500
0
1
--
510
1
1
--
520
1
0
--
530
0
0
--
600
0
1
--
610
1
1
--
620
1
0
--
630
0
0
--
700
0
1
--
710
1
1
--
720
1
0
--
730
0
0
--
800
0
1
--
810
1
1
--
820
1
0
--
830
0
0
--
900
0
1
--
910
1
1
--
920
1
0
--
930
0
0
--
1000
0
0
--
1010
1
0
--
1020
1
1
--
1030
0
1
--
1040
0
0
--
1110
1
0
--
1120
1
1
--
1130
0
1
--
1140
0
0
--
1210
1
0
--
1220
1
1
--
1230
0
1
--
1240
0
0
--
1310
1
0
--
1320
1
1
--
1330
0
1
--
1340
0
0
--
1410
1
0
--
1420
1
1
--
1430
0
1
--
1440
0
0
--
1510
1
0
--
1520
1
1
--
1530
0
1
--
1540
0
0
--
1610
1
0
--
1620
1
1
--
1630
0
1
--
1640
0
0
--
1710
1
0
--
1720
1
1
--
1730
0
1
--
1740
0
0
--
1810
1
0
--
1820
1
1
--
1830
0
1
--
1840
0
0
--
1910
1
0
--
1920
1
1
--
1930
0
1
--
1940
0
0
--
&
## ADVPINREGACTIONS
--
&
--
COND1
Any






--
&
## CLOCK
&
## STIMULUSFILE
&
## RESPONSEFILE
&
## ASYNCH
&
## ADVANCEDSCL

&

Use this code to verify that the requested functionality is supported.

 

When the $100.00 (US dollars) is received I will send you the BoostC source file.

Edited by cac001

Share this post


Link to post
Share on other sites

hmmm,

Where are you? you are the only one who can save me from losing a $100. :(

Is this what you want?

 

Raghunathan.

Share this post


Link to post
Share on other sites

First you offer the challenge to code what he described:

I will give you $100.00 if you write a code from what he has described.

Now you raise the bar to what he wants:

hmmm,

Where are you? you are the only one who can save me from losing a $100. :(

Is this what you want?

The only issue left is do you believe that the code does what he described?

 

You should be able to figure this one out yourself.

 

I am happy to accept any conclusion you honestly arrive at. :(

Share this post


Link to post
Share on other sites

lol this thread is priceless. You just paid for your commercial SB license with such a simple program. You should give Dave and Pavel some commission for setting it up on their forum. Makes me want to get into contract work...

Share this post


Link to post
Share on other sites

Just because it's short does not necessarily mean that it is simple.

 

Creating the code is one thing but getting paid may be something else. :(

Share this post


Link to post
Share on other sites
Just because it's short does not necessarily mean that it is simple.

I wasn't paying attention to the length of code, I just looked at the problem description. Maybe there's something to it I didn't see, but...

 

Good luck getting paid. :(

Share this post


Link to post
Share on other sites
I wasn't paying attention to the length of code, I just looked at the problem description.  Maybe there's something to it I didn't see, but...

Oh but I was referring to the description.

The original poster (OP) compressed out almost all of the useful information.

 

This looks a lot like a class assignment that has been circulating on some of the other PIC forums for the past few months.

 

I would like to think if SourceBoost is used in the course that the instructor or teaching aid would be checking this forum from time to time to see if someone is getting a little too much help with their class work.

 

To any instructors out there that may read this:

 

It would be a good idea at the start of your class to post a link to your course homepage on this forum and on the forums at Microchip, HITECH, CCS and other manufacturer's site for tools you use in your course.

 

That way the regulars here could know what to watch for and who to contact should something get out of hand.

Edited by cac001

Share this post


Link to post
Share on other sites

Hey if we are selling things now, i'll sell code + design for an auto-balancing

full bridge strain gauge for ~ $1k.

 

Then it will give me a reason to upgrade my licenses to allow commercial use :(

... altho i'll have to upgrade them in a couple months anyway ...

 

Maybe we will get a sale on upgrades ...

Btw when i do upgrade, i need to buy the upgrade for each of my nodes right?

Edited by emte

Share this post


Link to post
Share on other sites
First you offer the challenge to code what he described:
I will give you $100.00 if you write a code from what he has described.

Now you raise the bar to what he wants:

hmmm,

Where are you? you are the only one who can save me from losing a $100. :(

Is this what you want?

The only issue left is do you believe that the code does what he described?

 

You should be able to figure this one out yourself.

 

I am happy to accept any conclusion you honestly arrive at. :(

 

O.K cac,

I will keep my word. Send me your contact thro' a personal mail. I will not promise any time frame. But cash definitely will reach you.

 

Regards,

Raghunathan.

Share this post


Link to post
Share on other sites
Hey if we are selling things now...

This really is not an attempt to sell code.

 

This is more of the form - "The description of the project is so bad I bet you $100 you cannot write the application described."

 

The OPs description is only just good enough to maybe write something useful.

 

It has been a fun little diversion.

 

cac.

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×