12f675_fuse_about_to_blow! - Page 8


Closed Thread
Page 8 of 24 FirstFirst ... 45678910111218 ... LastLast
Results 281 to 320 of 929
  1. #281
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    That chip defaults to 4 MHz so you will want to add DEFINE OSC 4 to the beginning of your code.
    That really did crack it you little star you.........!

    The program works with just '3' being sent, fantastic.....!!!

    Probably a good point to end for the weekend but what next? Transmit from the PIC to pc?

    I've got to say, this is brilliant stuff. I've got to stop myself from wearing a whole in the carpet walking from one pc to the other to send '3' down the wire.

    Once again mackrackit, many thanks for your time, effort and perseverance, really.

    Dave
    Last edited by LEDave; - 12th April 2010 at 00:04.

  2. #282
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by LEDave View Post
    Probably a good point to end for the weekend but what next? Transmit from the PIC to pc?
    Yup, Write code and set the hardware up so whatever you send to the PIC® echos bach to the PC.
    I've got to say, this is brilliant stuff. I've got to stop myself from wearing a whole in the carpet walking from one pc to the other to send '3' down the wire.
    Pretty soon you will be able to do things remotely.
    Once again mackrackit, many thanks for your time, effort and perseverance, really.
    No problem, I enjoy it when someone wants to learn.
    Dave
    Always wear safety glasses while programming.

  3. #283
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit,

    The serial data transfer is working a treat

    Before we move on a couple of quick questions I'm a little confused on.

    1/ 16780. This is the MODE for inverted 2400 baud right?

    2/ The 'inverted' baud. Is that just keeping the transmit voltage level from pc - PIC at TTL levels 0 and +5v, instead of + or - 12v as used it RS232?

    Right then what's next (I've got a spare brown wire here just itching to send something out of my PIC)
    Last edited by LEDave; - 12th April 2010 at 21:27.

  4. #284
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Would this work to send '4' out on PORTC.3 when '3' comes in from the pc.

    Code:
    ANSEL   = %00000000    'Disable analog select so ports work as digital i/o.
    CMCON0  = %00000111    'Disable analog comparators.
    TRISA   = %00000000    'Set PORTA as OUTPUT.
    PORTA   = %00000000    'Set PORTA pins all low.
    TRISC   = %00000000    'Set PORTC as OUTPUT.
    PORTC   = %00000000    'Set PORTC pins all low.
    
    MYVAR  VAR BYTE 
    
    DATA_OUT CON 4 
     
    MAIN:
    PAUSE 250
    SERIN2 PORTC.5, 16780, [DEC MYVAR] '2400 INVERTED
    IF MYVAR = 3 THEN HIGH PORTA.5
    PAUSE 5000
    LOW PORTA.5
    PAUSE 250
    SEROUT2 PORTC.3, 16780, [DEC DATA_OUT]
    PAUSE 5000
    GOTO MAIN
    Last edited by LEDave; - 12th April 2010 at 22:23.

  5. #285
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    1/ 16780. This is the MODE for inverted 2400 baud right?
    Correct
    2/ The 'inverted' baud. Is that just keeping the transmit voltage level from pc - PIC at TTL levels 0 and +5v, instead of + or - 12v as used it RS232?
    Nope, inverted means 1 is 0 and 0 is 1.
    It is still 0 to +5.

    What I can see of your code on my phone it looks like it should work.
    Dave
    Always wear safety glasses while programming.

  6. #286
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Smile

    What I can see of your code on my phone it looks like it should work.
    And you were right mackrackit

    '3' came in from the pc and '4' arrived on the pc, brilliant!

    Where to next? send some text?

    Dave

  7. #287
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    You can send some text.

    And.....

    Now would be a good time to play with the SERIN2/SEROUT2 modifiers.
    Data can be formatted several ways, HEX, BIN, DEC, ASC||, STRings...

    Might be something sorta fun... Send a number to the PIC® say in DECimal format and have the PIC® return the number in other formats. Play with every combination you can think of. This should give you an understanding how different number systems work with this system.

    Could even send a couple of numbers and have an operation done on them and the results sent back to the PC.
    Dave
    Always wear safety glasses while programming.

  8. #288
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    I'm on it.

    Could take a day or two (or three) though. One or two 'holes' to plug in LEDave's knowledge base, bear with me.

    As an aside here, is it just me or is there something 'magical' 'mystical' even about all this? You've a little black 'spider' with 14 legs and three wires attached and numbers appearing on a monitor at the press of a button, I love it.

    Must dash, work, work, work and a lot of reading to do.

    Dave

  9. #289
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by LEDave View Post
    As an aside here, is it just me or is there something 'magical' 'mystical' even about all this? You've a little black 'spider' with 14 legs and three wires attached and numbers appearing on a monitor at the press of a button, I love it.
    Kind of like science fiction.
    Dave
    Always wear safety glasses while programming.

  10. #290
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Kind of like science fiction.
    Exactly,even stranger though!

    Here's tonight's effort, it works up to DEC255 then ouputs a zero for 256 etc, which is larger than a BYTE I'm thinking.

    Code:
    ANSEL   = %00000000    'Disable analog select so ports work as digital i/o.
    CMCON0  = %00000111    'Disable analog comparators.
    TRISA   = %00000000    'Set PORTA as OUTPUT.
    PORTA   = %00000000    'Set PORTA pins all low.
    TRISC   = %00000000    'Set PORTC as OUTPUT.
    PORTC   = %00000000    'Set PORTC pins all low.
    
    DEFINE OSC 4
    
    MYVAR  VAR BYTE 
     
    MAIN:
    PAUSE 250
    SERIN2 PORTC.5, 16780, [DEC MYVAR] 'MODE 16780 = 2400 BAUD INVERTED 
    IF MYVAR = MYVAR THEN HIGH PORTA.5 'LET'S YOU INPUT ANY NUMBER.
    PAUSE 5000
    low PORTA.5
    pause 250
    SEROUT2 PORTC.3, 16780, [HEX MYVAR, 10, 13] 'OUTPUT IN HEX 'MYVAR' 10=L_FEED 13=C_RETURN
    pause 5000
    GOTO MAIN
    Last edited by LEDave; - 13th April 2010 at 20:02.

  11. #291
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    From the second part of the brief:

    Could even send a couple of numbers and have an operation done on them and the results sent back to the PC.
    Hmm, a little stumped here. To my mind (after a lot of reading but obviously not enough!) when the first BYTE (number) arrives I need to send it to a memory location where it won't be overwritten when the second BYTE arrives.Then add the two together.

    The only thing I've found so far that has a seperate address element is this (I think):

    Code:
     Label VAR Size[Number of elements]
    I'm thinking: MYVAR VAR BYTE [1] which is two elements 0,1. then somehow add element 0 to element1.

    Warm or way off?

    Dave

  12. #292
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Now I'm thinking:

    Code:
     Label VAR Size[Number of elements]
    Might be used to output a block of data....Mmm..

    A little more research me thinks.

    Dave

  13. #293
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    it works up to DEC255 then ouputs a zero for 256 etc, which is larger than a BYTE I'm thinking.
    Yup, remember when counting not to start at 1 like we were taught in school.
    Always start at the origin... ZERO

    Hmm, a little stumped here. To my mind (after a lot of reading but obviously not enough!) when the first BYTE (number) arrives I need to send it to a memory location where it won't be overwritten when the second BYTE arrives.Then add the two together.

    The only thing I've found so far that has a seperate address element is this (I think):
    I was thinking along the lines of something like this for now
    Code:
    NUM1  VAR  BYTE
    NUM2  VAR  BYTE
    I was saving ARRAYs for a little latter
    I'm thinking: MYVAR VAR BYTE [1] which is two elements 0,1. then somehow add element 0 to element1.
    But if you want to read ahead...
    http://www.picbasic.co.uk/forum/showthread.php?t=544
    Dave
    Always wear safety glasses while programming.

  14. #294
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit

    But if you want to read ahead...
    I'm with you, reading ahead is ok but learn to walk then run (or crawl then walk in my case).

    Just out of interest would the ARRAY idea have worked?

    This code is just an idea, is it on the right lines?

    Code:
    SERIN2 PORTC.5, 16780, [DEC NUM1] 'MODE 16780 = 2400 BAUD INVERTED
    
    SERIN2 PORTC.5, 16780, [DEC NUM2] 'MODE 16780 = 2400 BAUD INVERTED
    
    LET TOTAL = NUM1 + NUM2
    
    SEROUT2 PORTC.3 TOTAL

  15. #295
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    An array can be made to work and so could your code as it is written, but...

    One of the things you need to consider is, how is the data coming into the MCU?
    123
    1,2,3
    12,3
    12M3
    ...........
    The code on the MCU needs to know what to expect or it is not going to know what to do with the data.
    That is where arrays come in handy, but then you need to figure out what and where the data you want to use is located in the array.

    I know, not a direct answer
    Reread the section of the manual SERIN2 and the WAIT thing. Also find out what DEC2 or DEC3 does.
    Dave
    Always wear safety glasses while programming.

  16. #296
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    I've been trying to use WAIT. I put in ( 2 ) hoping it would let me enter two numbers but it wouldn't compile (syntax error)

    Code:
     WAIT ( ) Wait for sequence of characters
    Reread the section of the manual SERIN2 and the WAIT thing. Also find out what DEC2 or DEC3 does.
    Will do, tomorrows task

  17. #297
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit,

    How does this look? It works but is it what you were after?

    Code:
    ANSEL   = %00000000    'Disable analog select so ports work as digital i/o.
    CMCON0  = %00000111    'Disable analog comparators.
    TRISA   = %00000000    'Set PORTA as OUTPUT.
    PORTA   = %00000000    'Set PORTA pins all low.
    TRISC   = %00000000    'Set PORTC as OUTPUT.
    PORTC   = %00000000    'Set PORTC pins all low.
    
    DEFINE OSC 4
    
    NUM1 VAR BYTE
    
    NUM2 VAR BYTE 
    
    TOTAL VAR BYTE
    
    i var byte
     
    MAIN:
    PAUSE 250
    
    SERIN2 PORTC.5, 16780,[WAIT ("N1="), DEC NUM1]  'MODE 16780 = 2400 BAUD INVERTED
    PAUSE 2000
    HIGH PORTA.5
    PAUSE 2000
    LOW PORTA.5
    SERIN2 PORTC.5, 16780,[WAIT ("N2="), DEC NUM2]
    
    HIGH PORTA.5
    LET TOTAL = NUM1 + NUM2
    PAUSE 2000
    low PORTA.5
    pause 250
    SEROUT2 PORTC.3, 16780, [DEC TOTAL, 10, 13] 'OUTPUT IN DEC 'TOTAL' 10=L_FEED 13=C_RETURN
    pause 2000
    GOTO MAIN
    Dave

  18. #298
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by LEDave View Post
    How does this look? It works but is it what you were after?
    COOL!!!
    I was not really after anything exactly, just trying to give you enough information to figure it out and you did!!!

    Now try sending sending 123 with out N1= or N2=.
    Code:
    SERIN2 PORTC.5, 16780,[DEC NUM1, DEC NUM2]
    Then try
    Code:
    SERIN2 PORTC.5, 16780,[DEC2 NUM1, DEC NUM2]
    Then try
    Code:
    SERIN2 PORTC.5, 16780,[DEC NUM1, DEC2 NUM2]
    Then try
    Something else....
    You will also want to look at the TIME OUT option of SERIN2.
    Dave
    Always wear safety glasses while programming.

  19. #299
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Code:
     [WAIT ("N1=")
    This took me ages to figure out But hey, got there in the end

    I've also had a little play with DEC, DEC1.... late last night.

    From what I've found, I think I'm right in saying 'DEC' is good up to 255 NUM1 VAR BYTE, send 256 and it returns a '0'.

    'DEC1' is good 0 - 9 if you sent '23' then you'd only get a '2'

    'DEC4' If you'd sent '99' you'd get '0099', '255' would give '0255' & 256 would return '0000'........ETC.

    I'll have a look at the combinations you've posted this evening.

    I know progress is slow but we're making progress

    See you later.

    Dave

  20. #300
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    This took me ages to figure out But hey, got there in the end
    You are doing great. It does take some time to learn how to think this way.

    DEC does determin the "size" but not as you think.
    DEC is for how many digits to grab.
    If 123 is sent and the receiving end is DEC2 the info gathered will be 12. The first two decimal places.

    Looks like you are getting VARIABLE size confused with this.

    The manual talks about this...
    BIT = 0 to 1
    BYTE = 0 to 255
    WORD = 0 to 65535

    In Binary a BIT will represent one place (_)
    BYTE will represent eight places (_ _ _ _ _ _ _ _)
    WORD will represent sixteen places (_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _)

    8 BITs in a BYTE
    2 BYTEs in a WORD
    Dave
    Always wear safety glasses while programming.

  21. #301
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit,

    I run those number variations / combinations, what a difference:

    Code:
    SERIN2 PORTC.5, 16780,[DEC NUM1, DEC NUM2]
    This one grabbed 123 then added 123 to give 246.

    Code:
    [DEC2 NUM1, DEC NUM2]
    This one grabbed the 1 and the 2 to give twelve, then added the 3 to give 15.

    Code:
    [DEC NUM1, DEC2 NUM2]
    This grabbed 123 + 12 to give 135

    Like you said earlier:

    One of the things you need to consider is, how is the data coming into the MCU?
    I can see this is very important, you've got to be comparing apples with apples, or else you're in real trouble, or at least be aware of how the numbers will be affected, your term 'grabbed' was right on the money.

    Looks like you are getting VARIABLE size confused with this.
    Guilty, I do tend to look at things one dimentionally before moving around and taking another view of things. It's that old lack of knowledge thing again

    Ah just remembered, in the PICBASIC PRO book, the DB9 cable dia has a 22k series resistor on PIN3, do I need to add one or am I ok you think? (I can't smell any smoke)

    Where to next......?

    Dave
    Last edited by LEDave; - 14th April 2010 at 21:06.

  22. #302
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Probably a good idea to use the resistor, on both pins 2 and 3.

    Next... Some flow control.
    What happens if you do not send data? _____________
    There is a TIME OUT/ LABEL thing that goes with SERIN2 just for that.

    Write a sub routine to indicate that data has not been received. Make it short, could be missing data while in the sub routine.
    Dave
    Always wear safety glasses while programming.

  23. #303
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Mmm, interesting.....!

    More reading / GQQGLING for me.

    Quick question, we set the mode to 16780 (2400 baud inverted). Does this in tern automatically set the FlowPin to the correct enabled state? 'This enabled state is determined by the polarity of the data specified by mode' (from the manual).

    Also what's a reasonable 'Timeout' period in milliseconds for this?

    I'll pick up a couple of resistors in the morning.

    See you tomorrow.

    Dave

  24. #304
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Yes, the FLOW PIN is automatically taken care of if used, but we do not need it for what we are doing. It is an option only.
    Also what's a reasonable 'Timeout' period in milliseconds for this?
    That depends on the whole setup for what you intend to do. For these test with keyboard/PC entry 500+ might be a good place to start. If you are connected to something like a GPS that continuously sends data and depending on what else the program does 100 may be what works.
    Dave
    Always wear safety glasses while programming.

  25. #305
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Quick question. What happens to the value of TOTAL at it's memory location after it's sent serially?
    Does the memory location automatically get reset to zero or does the value TOTAL stay there until over-written
    by the next TOTAL value to be sent?

    Code:
    SEROUT2 PORTC.3, 16780, [DEC TOTAL, 10, 13]
    Dave

  26. #306
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    It stays until over-written or power down.
    Dave
    Always wear safety glasses while programming.

  27. #307
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit,

    I expect you can hear the cogs grinding from where you are today

    Here's what I'm thinking:

    Code:
    Timeout con 500
     
    MAIN:
    PAUSE 250
    
    SERIN2 PORTC.5, 16780, [WAIT ("#"),DEC NUM1,Timeout,Data_Not_Sent,]
    I've made Timeout a CONSTANT 500. Then the program goes to the LABEL Data_Not_Sent. This is were I'm struggling in that I need to be able to tell if the data has been sent. If TOTAL did reset to zero when data was sent I could have used that but it doesn't and it could have just sent to nought's so that would be no good for a handle anyway. Then I though I could 'read' the PIN PORTC.3 to see if that had changed state, again that's only 50-50 that it has from HO to Low and also it could have just sent two zero's which would show no change.

    So I'm looking for something to show a change or changed state when data is sent (I think).

    Am I hot or cold in that last assumption?

    Dave

  28. #308
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Code:
    SERIN2 PORTC.5, 16780,Timeout,Data_Not_Sent,[WAIT ("#"),DEC NUM1]
    The SERIN2 command looks for the change of state, when using RF the time out thing does not work very well because of noise. The state is always changing even if data is not being sent.
    Last edited by mackrackit; - 15th April 2010 at 15:42.
    Dave
    Always wear safety glasses while programming.

  29. #309
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    The SERIN2 command looks for the change of state
    So SERIN2 looks at SEROUT2 (PORTC.3) to see if data has been sent?

    PORTC.3's pin state is the key to DATA_Not_Sent?

    I'm either getting a lot warmer or a lot colder with that one.

  30. #310
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    North of the Arctic Circle on that one...

    The time-out option looks for a state change on the serial input pin to see if data has been received on that pin.
    Dave
    Always wear safety glasses while programming.

  31. #311
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    North of the Arctic Circle on that one...
    Lol......!

    It was a bit of a howler wan't it, oh dear.

  32. #312
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    I've just re-read the brief mackrackit.

    What happens if you do not send data?
    I thought you meant from the PIC to the pc, that's why I kept going towards a change of state on SEROUT2 (PORTC.3).

    I see what you're saying now (I still don't now the answer (yet)) at least I'm looking in the right area now (I think).

    Dave

  33. #313
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Yup, you are heading South now.
    While I am on my way North with the gizmo I am playing with.
    Dave
    Always wear safety glasses while programming.

  34. #314
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Yup, you are heading South now.


    While I am on my way North with the gizmo I am playing with.
    I'm intrigued, what you working on then mackrackit

  35. #315
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I got the bright idea that would figure this one out.
    http://www.picbasic.co.uk/forum/showthread.php?t=12948
    Dave
    Always wear safety glasses while programming.

  36. #316
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Mmm,

    I'm might be able to help you, in about 15 years....!

  37. #317
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit,

    I've got something that 'works'

    Code:
    ANSEL   = %00000000    'Disable analog select so ports work as digital i/o.
    CMCON0  = %00000111    'Disable analog comparators.
    TRISA   = %00000000    'Set PORTA as OUTPUT.
    PORTA   = %00000000    'Set PORTA pins all low.
    TRISC   = %00000000    'Set PORTC as OUTPUT.
    PORTC   = %00000000    'Set PORTC pins all low.
    
    DEFINE OSC 4
    
    NUM1 VAR BYTE
    
    NUM2 VAR BYTE 
    
    TOTAL VAR BYTE
    
    Timeout con 10000
     
    MAIN:
    PAUSE 250
    
    SERIN2 PORTC.5, 16780,Timeout,Data_Not_Sent,[DEC NUM1, DEC2 NUM2]  
    PAUSE 6000
    HIGH PORTA.5
    PAUSE 1000
    LOW PORTA.5
    
    LET TOTAL = NUM1 + NUM2
    PAUSE 250
    
    SEROUT2 PORTC.3, 16780, [DEC TOTAL, 10] 
    pause 250
    
    DATA_Not_sent:
    High PORTA.1
    PAUSE 75
    LOW PORTA.1
    GOTO MAIN
    If I just load the program into the 16F684 and leave it running, every 10 secs PORTA.1 LED blinks as per the Timeout setting. I've given it a 10 secs delay because it takes about 4 secs to input two numbers into my clunky old keyboard.

    You might be wondering why there's a six second delay after the NUM's are inputted, it's so I can visually see via the LED PORTA.5 that it has arrived (if that makes sense).

    What do you think.

    Dave
    Last edited by LEDave; - 16th April 2010 at 13:45.

  38. #318
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,523


    Did you find this post helpful? Yes | No

    Default

    That's great Dave, you're making a lot of progress!

    What happens if you input 200 and 300 for num1 and num2 ? Why?

    Next challenge, if mackrackit don't mind:
    Make it so you actually input the complete equation, not only the two numbers. In other words 200+300 or 20-30 or 5*12 or....

    /Henrik.

  39. #319
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Looking good Dave!!!

    Now you have Henrik's challenge.
    Sounds like a good next step to me.

    Henrik, I do not mind at all, the more teachers the better.
    Dave
    Always wear safety glasses while programming.

  40. #320
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    That's great Dave, you're making a lot of progress!
    Thanks to mackrackit and yourself I am When you think that in February I couldn't turn an LED on or even create a HEX file....!

    Right then:

    What happens if you input 200 and 300 for num1 and num2 ? Why?
    Well the answer / output would be 230. Reason 200 is fine (BYTE = 255) the 300 which due to a mistake by me I set as D2 (DECIMAL2) in the program only takes the first two digits 30 so 200+30=230. How does that sound?

    Make it so you actually input the complete equation, not only the two numbers. In other words 200+300 or 20-30 or 5*12 or....
    Well the for first part 200+300 I'd have to set TOTAL VARIABLE BYTE to TOTAL VARIABLE WORD for the number 300 (that's assuming you can add a BYTE to a WORD.....Mmm, something makes me think this isn't going to be that straight forward......!
    Last edited by LEDave; - 16th April 2010 at 16:59.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts