What is wrong?


+ Reply to Thread
Results 1 to 12 of 12

Thread: What is wrong?4127 days old

  1. #1
    Junior Member laserline's Avatar
    Join Date
    Jan 2007
    Posts
    28
    Thumbs Up
    Received: 0
    Given: 2
    Total Downloaded
    1.81 GB

    0 Not allowed!

    Default What is wrong?

    Device 18F452
    Declare XTAL 10
    Declare PLL_REQ = On
    Declare OPTIMISER_LEVEL = 6
    ALL_DIGITAL = True

    > This code works!
    ======================
    Dim Address as DWORD

    Address = 0
    While Address < 255
    ... do something
    Inc Address
    Wend
    ======================


    > This one does not work...
    ======================
    Dim Address as DWORD

    Address = 0
    While Address < 256
    ... do something
    Inc Address
    Wend
    ======================


    > But... this other works!
    ======================
    Dim Address as DWORD

    Address = 0
    While Address < 258
    ... do something
    Inc Address
    Wend
    ======================

    Can anyone inform what is wrong???

    Much thanks in advance!

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,703
    Thumbs Up
    Received: 48
    Given: 95
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default

    What version of the compiler are you using?
    Tim

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Junior Member laserline's Avatar
    Join Date
    Jan 2007
    Posts
    28
    Thumbs Up
    Received: 0
    Given: 2
    Total Downloaded
    1.81 GB

    0 Not allowed!

    Default

    Hi Tim,

    Thanks for the reply!

    Compiler version 3.2.5.5

    IDE version 1.0.4.6

    I tested a lot of times.... with <= 255 and >= 257 it's OK, but with 256... no no.
    I compiled with and without the OPTIMISER and the result was the same.

    Regards,
    Paulo

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    wastrix
    Guest

    0 Not allowed!

    Default

    Perhaps this is a minor bug in proton allocating memory. Perhaps if the number is 256 or under, the compiler thinks it is a byte or something and throws an error

    Just a guess, though, and probably a wrong one

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    wastrix
    Guest

    0 Not allowed!

    Default

    UPDATE!
    Errr... Actually, I am using compiler v3.2.5.5 with your code:
    Device 18F452
    Declare XTAL 10
    Declare PLL_REQ = On
    Declare OPTIMISER_LEVEL = 6
    ALL_DIGITAL = True

    Dim Address As DWord

    Address = 0
    While Address < 256
    Toggle PORTD.0
    DelayMS 10
    Inc Address
    Wend
    It compiles perfectly, and when I test it in the VSM, it works perfectly as well. Nice pulse train coming out of portd.0

    Note: you set xtal to 10mhz, and then setpll_req on. I get a warning from the compiler saying: "Now operating at a frequency of 40mhz using PLL fuse configuration"
    Does this mean that it is actually running at 40mhz?


  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Junior Member laserline's Avatar
    Join Date
    Jan 2007
    Posts
    28
    Thumbs Up
    Received: 0
    Given: 2
    Total Downloaded
    1.81 GB

    0 Not allowed!

    Default

    Hi,

    Thank you.

    I am still not able to make this work inside my code... perhaps it's because theres much more declared variables... don't know.

    I will try to run only this code too, let's see if it works. ... tomorrow! )

    Kind regards,
    Paulo

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Hans Chr
    Guest

    0 Not allowed!

    Default

    you say that there are many more variables... could you look inside the asm file and see what ram banks the 4 bytes in 'address' var is located in?

    it has probably nothing to do with this, but nice to rule things out

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  15. #8
    Junior Member laserline's Avatar
    Join Date
    Jan 2007
    Posts
    28
    Thumbs Up
    Received: 0
    Given: 2
    Total Downloaded
    1.81 GB

    0 Not allowed!

    Default

    HI,

    I don't understand ASM very well, but here is what appears in the first lines of my ASM code:

    _X = 31
    _F = 32
    SAMPLE = 33
    MEMCODE = 34
    CTRLCODE = 35
    FILENUMBER = 36
    DWAUX = 37
    DWAUXH = 38
    DWAUXHH = 39
    DWAUXHHH = 40
    ADDRESSINI = 41
    ADDRESSINIH = 42
    ADDRESSINIHH = 43
    ADDRESSINIHHH = 44
    ADDRESSEND = 45
    ADDRESSENDH = 46
    ADDRESSENDHH = 47
    ADDRESSENDHHH = 48
    HEADER = 49

    Tks!

  16. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  17. #9
    Hans Chr
    Guest

    0 Not allowed!

    Default

    your variable of conflict is named "Address"

    you must find where

    ADDRESS
    ADDRESSH
    ADDRESSHH
    ADDRESSHHH

    is located. the number it equals is the address of the ram in the pic. look in datasheet and figure out how many ram banks there are. and see if any of the variables above crosses a bank boundary. then go to your asm code where it fails. see if the bank is set correctly when accessing the 4 vars above.

  18. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  19. #10
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,354
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default

    Hi Paulo,
    When you say it does not work, can you elaborate on that, I have just tried it in ISIS and it works fine. Using 3.3.4.8.

    You can see it in the PIC18_ALCD.

    Code:
    Device 18F452
    Declare XTAL 10
    Declare PLL_REQ = On
    Declare OPTIMISER_LEVEL = 6
    ALL_DIGITAL = True
    
    TRISC.1 = 0     'Channel 1 of VSM scope
    PORTC.1 = 0     'Turn output off
    
    TRISC.2 = 0     'Channel 2 of VSM scope
    
    Dim Address As DWord
    
    Address = 0
    While Address < 256
    Toggle PORTC.2  'Show output on channel B of scope
    DelayMS 10
    Inc Address
    Wend
    PORTC.1 = 1     'Turn output on so the end can be see on channel A on scope
    Regards,
    Bobby

  20. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  21. #11
    Junior Member laserline's Avatar
    Join Date
    Jan 2007
    Posts
    28
    Thumbs Up
    Received: 0
    Given: 2
    Total Downloaded
    1.81 GB

    0 Not allowed!

    Default

    Thanks everyone for the interest!

    Here is the part of my code that does not work with a value of 256:
    ================================================== =====
    CTRL:
    Low LED2: DelayMS 5: High LED2
    SerIn PORTC.7, 84, 2000 , CTRL ,[Wait ("CTRL")]
    SerIn PORTC.7, 84, [CtrlCode]
    Select Case CtrlCode
    Case 1 ' INIT REC
    GoTo RECIni
    Case 2 ' FORMAT Header
    AddressINI = 0
    Low LED2: DelayMS 100: High LED2: DelayMS 100: Low LED2
    While AddressINI < 255
    Low CS
    SHOut SDO, SCK, 1, [%00000110]
    High CS
    DelayUS 10
    Low CS
    SHOut SDO, SCK, 1, [%00000010]
    SHOut SDO, SCK, 1, [BTi2] ' AddressINI BYTE2
    SHOut SDO, SCK, 1, [BTi1] ' AddressINI BYTE1
    SHOut SDO, SCK, 1, [BTi0] ' AddressINI BYTE0
    SHOut SDO, SCK, 1, [%00000000]
    High CS
    Inc AddressINI
    DelayMS 5
    Wend
    . . .
    ================================================== =====

    Note that I am using "While AddressINI < 255". If I use 256 it just does not enter the Loop, the code ignores it.
    I already added some LED pulses inside the Loop to be able to debug it and when I use 256 the LEDs do not blink... like I said, it simply ignores the Loop.

    In fact this is not a real problem for my experiment, I just found it interesting and think that could be of any reference for others.

    Cheers from BraziL!

  22. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  23. #12
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,354
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default

    Hi Paulo,
    Can you post an example that can be simulated in the standard VSM's supplied with PDS?

    Regards,
    Bobby

  24. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. dropdownlists wrong?
    By Puffeltje in forum Fuse Configurator
    Replies: 2
    Last Post: 7th April 2019, 20:32
  2. Replies: 5
    Last Post: 4th April 2014, 12:26
  3. What's wrong with my for next loop???
    By SimonJA in forum Proton Plus Compiler v3
    Replies: 7
    Last Post: 19th December 2006, 18:37
  4. Wrong value return...
    By fanie in forum Proton Plus Compiler v3
    Replies: 6
    Last Post: 22nd July 2006, 01:29
  5. Something wrong with the keypad?
    By Pairair in forum Proton Development Board
    Replies: 9
    Last Post: 29th November 2004, 16:35

Tags for this Thread

Posting Permissions

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