Set a input without use stimuli file and do it on program line

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First i make you my apologise for my bad english.

Second please look on picture below before reading.

Now, i'm trying to build a test-bench (a program that run out Atmel Studio), for do this system i need to change the input status on line program like this:

PINB (0) = "1"  -->  where PINB is the port that is set in input mode and (0) is the bit0 of this port and "1" is the logical staus;

or like this : set PINB,0b00000001;

or ‎through a scripting, (better for me is on line program if is possible).

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The AVR simulator is aimed at "interactive" simulation - not really suitable for SIL - I don't it can be invoked and operated "blind" from the command line.

 

For SIL testing there have been a few other AVR simulation systems developed which are aimed more at command line (SIL) use.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

can you write a link or the name of the other AVR simulator system?

 

maybe i can resolve my problem using this escamotage/loophole --> can i write directly on memory to do what i want?

i find an old post where you wrote:

-----------------------------------------------------------------------------------------------------------------------------

Posted : Tue. Apr 11, 2006 - 12:44 PM

 

To read/write address 0x37 use:

unsigned char *p = 0x37;

x = *p; // read contents of 0x37
*p = 0x5A; // write the contents of 0x37

For all the IO registers in the AVR you'll find that once you #include and have set CPU type in your makefile that you don't need to know that PORTA is at address 0x37 anyway (not that it really is - this is just an example). Instead you'd just use:

x = PORTA;
PORTA = 0x5A;

Equally you wouldn't usually hard code an absolute SRAM address into your program either. You would declare variables which is just assigning a label to various memory locations that the compiler/linker manage for you then you read/write those variables and don't (generally) care what location they are actually held in.

Cliff

-----------------------------------------------------------------------------------------------------------------------------

so in my case if i do it:

..

unsigned char *p = 0x23;

*p = 0x01;

..

but i think it is write in C and it is functionally only in C;

there is a way to write it in assembler?

 

thank you.

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Take a step back and say what your high level goal here is. Perhaps I misinterpreted your original question? Perhaps it's not SIL (software in the loop) testing you are aiming for? (because I don't see how hard coding SFR addresses rather than using symbolic definition actually helps or has anything to do with this?)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok i make you my apologise if i don't tell you what is my final goal. i want to write a program (called TEST) in c++ that you can select the number of input and the number of output first=> built a interface window that allow the user to setup an configuration input and wiev the state of ouput, use atmel studio in debug mode (start & breaking), using the break point like in the picture:

1) in the solution/project write a *.c or *.cpp that read the state of input from a file -> SWAP.txt (write before by TEST);

2) replace/comment the line like "26| IN  LED_val,PINB" with a line that write the correct status of PINB;

3) replace/comment the line like "25| CBI  PORTB,5" with a line that write the state of output in the file or call the line in *.c or *.cpp for do the operation of write;

4) in TEST program use some funcion/code like this -> link ->"https://msdn.microsoft.com/it-it..." for run step by step or to the break point;

I do it for test the right flow chart of the program in assembler and i can print a grafic of the system compared with the clock system.

This is the first idea become in my head.

I'm so long to write, 'cause is the first time that i have a tecnical discussion in english.

Thank you for your time.

Last Edited: Wed. Jan 31, 2018 - 03:13 PM