Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Standard bliniking program not working?

Status
Not open for further replies.

crystal123

Newbie
Joined
Jul 11, 2016
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
99
Hello, everyone!

I am trying to get a standard linking led program running on my STM8S103F3P6 development board but I am not sure what I am doing wrong. I connected a LED to PIN D3, this is my code:
Code:
#include <stm8s. h>

void

delay_ ms (uint16. _t ms) ;

void

delay_ _ms(uint16 _t ms) {

while

(ms- -) {

uint16_ t i;

for

(i = 0:i< ms; i++){

nop () ;

}

}

}

main()

{

GPI0D- >DDR |=0x03;

//PD3 as Output

GPI0D- >CR1 |=0x03:

//PD3 as Push Pull

while

GPI0D- >0DR|=(1<<3) :

//turn PD3 on

de1ay_ ms (1000):

GPI0D->0DR&=' ~ (1<<3) ;

//turn PD3 off

delay_ ms (1000) :

}

}
[moderator action: removed hidden advertisement link]
 
Last edited by a moderator:

Hello!

There are many oddities in your code, so if you could first post something that compiles,
it would be easier. I suppose it would not compile as is, although I didn't try.

Example: delay_ ms (uint16. _t ms) ;
There is a space betweeb delay_ and ms, there is a dot and a space inside of what should be a
type (uint16. _t instead of uint16_t). Beside this, I'm not sure that a space inside of a pointer marker
(- > instead of ->) is legal. Etc...

Then you should also describe better what happens.
- If it doesn't compile, publish the errors you get (after trying to solve them yourself first).
- If it does compile, what happens? Can you follow the program in the debugger?

By the way, did you add a serial resistor for your LED?

Dora.
 

Each of the various typos would prevent compilation of the code. Either the posted text is not the original code, or you never compiled it.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top